This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

g++: <cmath> is missing C++11 functions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]