g++: <cmath> is missing C++11 functions
Achille Fouilleul
achille.fouilleul@gadz.org
Wed Jan 15 09:08:00 GMT 2014
Hi,
On cygwin64, g++ -std=c++11 fails to compile simple programs like this one:
#include <cstdio>
#include <cmath>
int main()
{
std::printf("%d\n", (int)std::lround(1.23));
return 0;
}
rr.cpp: In function ‘int main()’:
rr.cpp:6:28: error: ‘lround’ is not a member of ‘std’
std::printf("%d\n", (int)std::lround(1.23));
^
rr.cpp:6:28: note: suggested alternative:
In file included from
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/include/c++/cmath:44:0,
from rr.cpp:2:
/usr/include/math.h:278:17: note: ‘lround’
extern long int lround _PARAMS((double));
I have noticed that C++11 cmath functions are declared in the std
namespace only if _GLIBCXX_USE_C99_MATH_TR1 is defined.
It's not:
/usr/lib/gcc/x86_64-pc-cygwin/4.8.2/include/c++/x86_64-pc-cygwin/bits/c++config.h:1272:/*
#undef _GLIBCXX_USE_C99_MATH_TR1 */
Regards,
Achille
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list