Suslik
Suslik

Reputation: 1071

"fatal error: 'chrono' file not found" when compiling C++ project based on CMake

Do you know what that error message means and what I should do now?

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.

I have no idea about what I have to do now.

Upvotes: 3

Views: 10360

Answers (1)

m.s.
m.s.

Reputation: 16324

The build error probably means that the source file includes a C++11 header (<chrono>) but you are compiling without support for C++11. Given that your compiler supports C++11, you need to activate it using the following line in the CMakeLists.txt file:

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

Upvotes: 6

Related Questions