Я пытался скомпилировать следующий код с использованием g++ 14.1.0
Код: Выделить всё
//main.cpp
#include
int main(){
std::timespec CurrentTime;
std::timespec_get(&CurrentTime, TIME_UTC);
}
Код: Выделить всё
>g++ main.cpp -std=c++23
main.cpp: In function 'int main()':
main.cpp:5:14: error: 'timespec' is not a member of 'std'; did you mean 'timespec'?
5 | std::timespec CurrentTime;
| ^~~~~~~~
In file included from C:/msys64/mingw64/include/time.h:25,
from C:/msys64/mingw64/include/c++/14.1.0/ctime:42,
from main.cpp:2:
C:/msys64/mingw64/include/sys/timeb.h:101:8: note: 'timespec' declared here
101 | struct timespec {
| ^~~~~~~~
main.cpp:6:14: error: 'timespec_get' is not a member of 'std'
6 | std::timespec_get(&CurrentTime, TIME_UTC);
| ^~~~~~~~~~~~
main.cpp:6:28: error: 'CurrentTime' was not declared in this scope
6 | std::timespec_get(&CurrentTime, TIME_UTC);
| ^~~~~~~~~~~
main.cpp:6:41: error: 'TIME_UTC' was not declared in this scope
6 | std::timespec_get(&CurrentTime, TIME_UTC);
|
Я не знаю, почему происходит эта ошибка времени компиляции, и я был бы очень признателен, если бы кто-нибудь мог оказать помощь в исправлении этой ошибки.>
Подробнее здесь: https://stackoverflow.com/questions/797 ... ic-not-def
Мобильная версия