lundi 3 avril 2017

CMake: ‘sqrtf’ is not a member of ‘std’

After compiling my program with

$ cmake .
$ make

I get 5 errors of this form:

$ make
Scanning dependencies of target Project
[ 50%] Building CXX object CMakeFiles/http://ift.tt/2nzzcYd
In file included from /path/to/my/proj/main.cpp:2:0: 
/path/to/my/proj/library.hpp: In member function ‘virtual double MyProjClass::get_value(double, double) const’:
/path/to/my/proj/library.hpp:419:26: error: ‘sqrtf’ is not a member of ‘std’
     const float F = (std::sqrtf(1.0f + 2.0f) - 1.0f) / 2;
                      ^

Other errors include floorf not being a member of std.

Looking at this thread, it's because I'm not compiling with C++11, and looking at this thread thread, "[...] CMake will make sure the C++ compiler is invoked with the appropriate command line flags."

Well, my CMake is obviously not doing this. Why am I getting these errors, and how do I go about fixing them?

Aucun commentaire:

Enregistrer un commentaire