This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: g++4.9.2 fails to compile standard C++11 code
- From: Duncan Roe <duncan_roe at acslink dot net dot au>
- To: cygwin at cygwin dot com
- Date: Thu, 12 Mar 2015 20:55:59 +1100
- Subject: Re: g++4.9.2 fails to compile standard C++11 code
- Authentication-results: sourceware.org; auth=none
- References: <CAJ+GnyeViXtbQ6S=tC6z8XVZgOcoHv6Gi0ww8W1HEG_XKJrhUw at mail dot gmail dot com>
On Wed, Mar 11, 2015 at 06:55:16PM -0400, Vlad Gheorghiu wrote:
> The following code fails to compile under latest cygwin, Windows 7,
> g++4.9.2. Compiled with g++ -std=c++11 test.cpp. The compiler
> complains that std::log2 is not a member of std.
>
> #include <cmath>
> #include <iostream>
>
> int main()
> {
> auto x = std::log2(10);
> std::cout << x << std::endl;
> }
>
>
> Verbatim 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));
>
FWIW, this program works fine under Linux / gcc4.8.2:
20:45:23$ uname -a
Linux dimstar 3.19.0-k8 #1 SMP Mon Mar 2 21:58:02 EST 2015 i686 AMD Athlon(tm) 64 X2 Dual Core Processor 6000+ AuthenticAMD GNU/Linux
20:45:44$ g++ --version
g++ (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20:47:26$ g++ -std=c++11 cygwin.cpp -o cygwin
20:50:25$ ./cygwin
3.32193
20:50:36$ cat cygwin.cpp
#include <cmath>
#include <iostream>
int main()
{
auto x = std::log2(10);
std::cout << x << std::endl;
} /* int main() */
Cheers ... Duncan.
--
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