I am trying to test some C++11 code on Windows 7 under cygwin, and am getting compiling errors for functions that are defined starting with C++11, such as std::log2
and std::round
. I am compiling with g++ -std=c++11 test.cpp
, using gcc 4.9.2. Here is some minimal example that fails to compile:
#include <cmath> #include <iostream> int main() { auto x = std::log2(10); std::cout << x << std::endl; }
error:
g++ -std=c++11 test.cpp test.cpp: In function ‘int main()’: test.cpp:5:11: error: ‘log2’ is not a member of ‘std’ auto x = std::log2(10); ^ test.cpp:5:11: note: suggested alternative: In file included from /usr/lib/gcc/i686-pc-cygwin/4.9.2/include/c++/cmath:44:0, from test.cpp:1: /usr/include/math.h:305:15: note: ‘log2’ extern double log2 _PARAMS((double));
Is this a known bug in cygwin's g++ porting? The code above works fine on any Linux/UNIX flavour supporting C++11.