delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/03/12/07:29:37

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:references
:mime-version:content-type:in-reply-to; q=dns; s=default; b=gWg0
0TYu/gWgO6ys36lb2EFdfLxmmxok0TeuRBVLIj3Mn/yxe/v1nKYSdrDDpweQlVMH
QyA23JoPyODjpVYOrymuNY3JQkbYQkC3R8HLbd7NdARhVJiy4p1K4mru9Xpocfxs
s+VDKcrKa1h57cXUuqYs+Ymlf7xAYWoSXuyEQnU=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:references
:mime-version:content-type:in-reply-to; s=default; bh=Xg8NTFBWg+
NgXaQY7fFLty5nhYg=; b=l5uLPHJZem+bOoXlIyOE+IINabnsy11mfCrD+lZhiL
Verr7NmuIsGcGa+wFq3+nGqgqnpOkN0nQcoiVHIanTfNsmpKXbncvAODZkjDpTaP
WpXVloreoyQG/u84O9wBZfRr8jfrRWI/B/bgFUAD/7UIeyDWS4SK7rZsymEP3X/r
Y=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-HELO: mail106.syd.optusnet.com.au
Date: Thu, 12 Mar 2015 20:55:59 +1100
From: Duncan Roe <duncan_roe AT acslink DOT net DOT au>
To: cygwin AT cygwin DOT com
Subject: Re: g++4.9.2 fails to compile standard C++11 code
Message-ID: <20150312095559.GA2644@dimstar.local.net>
Mail-Followup-To: cygwin AT cygwin DOT com
References: <CAJ+GnyeViXtbQ6S=tC6z8XVZgOcoHv6Gi0ww8W1HEG_XKJrhUw AT mail DOT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <CAJ+GnyeViXtbQ6S=tC6z8XVZgOcoHv6Gi0ww8W1HEG_XKJrhUw@mail.gmail.com>
User-Agent: Mutt/1.5.22 (2013-10-16)
X-Optus-CM-Score: 0
X-Optus-CM-Analysis: v=2.1 cv=baJSDo/B c=1 sm=1 tr=0 a=+cDhJlqnNvz9E7c5l3ERGg==:117 a=+cDhJlqnNvz9E7c5l3ERGg==:17 a=y26AOypDAAAA:8 a=PO7r1zJSAAAA:8 a=M1kyBYkWWGkA:10 a=kj9zAlcOel0A:10 a=iaFubHWvAAAA:8 a=emO1SXQWCLwA:10 a=srZKfrl9To1BfipB_cQA:9 a=CjuIK1q_8ugA:10
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019