"fatal error: 'chrono' file not found" when compiling C++ project based on CMake
"fatal error: 'chrono' file not found" when compiling C++ project based on CMake
您知道该错误消息的含义以及我现在应该做什么吗?
vpn-global-dhcp3-252:build Dolyn$ make
Scanning dependencies of target mdatom
[ 10%] Building CXX object CMakeFiles/mdatom.dir/src/main.cpp.o
/Users/Dolyn/sources/src/main.cpp:124:11: fatal error:
'chrono' file not found
#include <chrono>
For high resolutio timings
^
1 error generated.
我不知道我现在要做什么。
构建错误可能意味着源文件包含 C++11 header (<chrono>
) 但您正在编译时不支持 C ++11。
鉴于您的编译器支持 C++11,您需要使用 CMakeLists.txt 文件中的以下行激活它:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
您知道该错误消息的含义以及我现在应该做什么吗?
vpn-global-dhcp3-252:build Dolyn$ make
Scanning dependencies of target mdatom
[ 10%] Building CXX object CMakeFiles/mdatom.dir/src/main.cpp.o
/Users/Dolyn/sources/src/main.cpp:124:11: fatal error:
'chrono' file not found
#include <chrono>
For high resolutio timings
^
1 error generated.
我不知道我现在要做什么。
构建错误可能意味着源文件包含 C++11 header (<chrono>
) 但您正在编译时不支持 C ++11。
鉴于您的编译器支持 C++11,您需要使用 CMakeLists.txt 文件中的以下行激活它:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")