g++4.9.2 fails to compile standard C++11 code
Christian Franke
Christian.Franke@t-online.de
Sat Mar 14 15:14:00 GMT 2015
Corinna Vinschen wrote:
> On Mar 13 09:13, Csaba Raduly wrote:
>> Hi
>>
>> On Thu, Mar 12, 2015 at 10:55 AM, Duncan Roe wrote:
>>> 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:
>> ISTR a discussion about some C++11 features being configured away due
>> to Cygwin's lack of some C library functions ("to_string not a member
>> of std"): https://sourceware.org/ml/cygwin/2015-01/msg00245.html
>>
>> Your issue may be related (I'm guessing here because I don't have
>> Cygwin at hand right now).
> I guess the same. The problem is probably related to the fact that
> newlib is still missing most of the long double functions (cosl, sinl,
> etc). The libstdc++ configury seems to activate the related std methods
> only if *all* related C library functions for double, float and long
> double (e.g. cos, cosf, cosl) are implemented by the platform.
Yes. The attached patch for cmath include file would fix this.
Christian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmath-c99-functions.patch
Type: text/x-patch
Size: 3375 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20150314/226d7d9b/attachment.bin>
-------------- next part --------------
--
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