Re: C++11 program link failure under GCC 4.8.2-1

2014-03-12 Thread zosrothko
Hi

Below are the compile time __STRICT_ANSI__ defines for various standards
supported by g++

FrancisANDRE@idefix /usr/include
$ gcc -xc++ -std=c++0x -dM -E -  /dev/null | grep ANSI
#define __STRICT_ANSI__ 1

FrancisANDRE@idefix /usr/include
$ gcc -xc++ -std=c++11 -dM -E -  /dev/null | grep ANSI
#define __STRICT_ANSI__ 1

FrancisANDRE@idefix /usr/include
$ gcc -xc++ -std=gnu++11 -dM -E -  /dev/null | grep ANSI

FrancisANDRE@idefix /usr/include
$ gcc -xc++ -std=c++98 -dM -E -  /dev/null | grep ANSI
#define __STRICT_ANSI__ 1

All but c++11 define __STRICT_ANSI__. That's why your sample does not
compile. This a issue with the cygwin includes that should provide snprintf
for c++11 also not only for other standards.



--
View this message in context: 
http://cygwin.1069669.n5.nabble.com/C-11-program-link-failure-under-GCC-4-8-2-1-tp104247p107069.html
Sent from the Cygwin list mailing list archive at Nabble.com.

--
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



Re: C++11 program link failure under GCC 4.8.2-1

2013-11-13 Thread Corinna Vinschen
On Nov 12 18:37, Ryan Johnson wrote:
 On 12/11/2013 5:30 PM, JonY wrote:
 Right now, it is guarded by:
 #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ = 199901L)
 
 Which means non-strict mode and C99 mode, snprintf was not part of
 C++03. I guess (__cplusplus = 201103L) needs to be added to newlib.
 Yes, this has come up before [1]. Several *printf variants are
 affected IIRC.
 
 [1] http://cygwin.com/ml/cygwin/2012-04/msg00140.html

I wouldn't mind to see patch submissions fixing stuff like that on the
newlib mailing list.  Not at all.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat


pgpvU9RIv_PgK.pgp
Description: PGP signature


Re: C++11 program link failure under GCC 4.8.2-1

2013-11-13 Thread Christopher Faylor
On Wed, Nov 13, 2013 at 10:15:02AM +0100, Corinna Vinschen wrote:
On Nov 12 18:37, Ryan Johnson wrote:
 On 12/11/2013 5:30 PM, JonY wrote:
 Right now, it is guarded by:
 #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ = 199901L)
 
 Which means non-strict mode and C99 mode, snprintf was not part of
 C++03. I guess (__cplusplus = 201103L) needs to be added to newlib.
 Yes, this has come up before [1]. Several *printf variants are
 affected IIRC.
 
 [1] http://cygwin.com/ml/cygwin/2012-04/msg00140.html

I wouldn't mind to see patch submissions fixing stuff like that on the
newlib mailing list.  Not at all.

What an odd notion.

cgf

--
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



Re: C++11 program link failure under GCC 4.8.2-1

2013-11-13 Thread Corinna Vinschen
On Nov 13 09:01, Christopher Faylor wrote:
 On Wed, Nov 13, 2013 at 10:15:02AM +0100, Corinna Vinschen wrote:
 On Nov 12 18:37, Ryan Johnson wrote:
  On 12/11/2013 5:30 PM, JonY wrote:
  Right now, it is guarded by:
  #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ = 199901L)
  
  Which means non-strict mode and C99 mode, snprintf was not part of
  C++03. I guess (__cplusplus = 201103L) needs to be added to newlib.
  Yes, this has come up before [1]. Several *printf variants are
  affected IIRC.
  
  [1] http://cygwin.com/ml/cygwin/2012-04/msg00140.html
 
 I wouldn't mind to see patch submissions fixing stuff like that on the
 newlib mailing list.  Not at all.
 
 What an odd notion.

Yeah, I'm that crazy sometimes.


Corinna

-- 
Corinna Vinschen  Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat


pgpsdKAN3To88.pgp
Description: PGP signature


Re: C++11 program link failure under GCC 4.8.2-1

2013-11-13 Thread Christopher Faylor
On Wed, Nov 13, 2013 at 04:19:15PM +0100, Corinna Vinschen wrote:
On Nov 13 09:01, Christopher Faylor wrote:
 On Wed, Nov 13, 2013 at 10:15:02AM +0100, Corinna Vinschen wrote:
 On Nov 12 18:37, Ryan Johnson wrote:
  On 12/11/2013 5:30 PM, JonY wrote:
  Right now, it is guarded by:
  #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ = 199901L)
  
  Which means non-strict mode and C99 mode, snprintf was not part of
  C++03. I guess (__cplusplus = 201103L) needs to be added to newlib.
  Yes, this has come up before [1]. Several *printf variants are
  affected IIRC.
  
  [1] http://cygwin.com/ml/cygwin/2012-04/msg00140.html
 
 I wouldn't mind to see patch submissions fixing stuff like that on the
 newlib mailing list.  Not at all.
 
 What an odd notion.

Yeah, I'm that crazy sometimes.

Yeah, I know.  Crazy cat lady.

cgf

--
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



Re: C++11 program link failure under GCC 4.8.2-1

2013-11-12 Thread JonY
On 11/12/2013 07:37, Yucong Sun wrote:
 Yes, the sha1 matches.
 
 sunyc@sunyc-wks /lib/gcc/i686-pc-cygwin/4.8.2
 $ sha1sum.exe libstdc++.*
 f4dfadfddade3aceaf4852cd5db31372ab7ef0d1 *libstdc++.a
 963e2a697c3a1a7d036d975b07f4c408bbd1cb2d *libstdc++.dll.a
 
 Also I couldn't find GLIB_xxx version number in libstdc++.a

Those are ELF versioning, Windows does not have it.




signature.asc
Description: OpenPGP digital signature


Re: C++11 program link failure under GCC 4.8.2-1

2013-11-12 Thread JonY
On 11/12/2013 10:33, Yucong Sun wrote:
 I've tried on both 32bit and 64bit clean cygwin install, the result is
 same. Something is wrong with cygwin's gcc.
 
 my configure script by default uses g++ --std=c++11, this still have
 problem of  no snprintf  , after I replace all snprintf() with
 sprintf() , I've met the same linkage problem again.
 

Something else is very wrong.

 g++ --std=gnu++0x fixes the snprintf problem, but it still have same
 linkage problem.
 

Please make a minimalist case, I've tried some basic C++11 features but
I don't get such errors.




signature.asc
Description: OpenPGP digital signature


Re: C++11 program link failure under GCC 4.8.2-1

2013-11-12 Thread Yucong Sun
Good new! I've found the link failure issue, it is caused by  -rdynamic

sunyc@sunyc-wks ~
$ cat 2.cc
#include deque

struct tick_event {
int i;
};

int main() {
std::dequetick_event * list;

tick_event *a = new tick_event;
list.push_back(a);
return 0;
}

sunyc@sunyc-wks ~
$ g++ -c --std=c++11 -O3 -flto 2.cc -o 2.o

sunyc@sunyc-wks ~
$ g++ --std=c++11 -flto -D_GNU_SOURCE -rdynamic -fno-omit-frame-pointer -D_GNU_
SOURCE -march=native  -O3 2.o -o a
Cannot export _ZNSt5dequeIP10tick_eventSaIS1_EE16_M_push_back_auxIJRKS1_EEEvDpOT
_: symbol wrong type (4 vs 3)
collect2: error: ld returned 1 exit status


sunyc@sunyc-wks ~
$ g++ --std=c++11 -flto -D_GNU_SOURCE -fno-omit-frame-pointer -D_GNU_SOURCE -ma
rch=native  -O3 2.o -o a

sunyc@sunyc-wks ~
$

Hope it would help you nail the problem.


And Here's the test case for snprintf  c++11

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-cygwin/4.8.2/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2/co
nfigure --srcdir=/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2 --
prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdi
r=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --lib
dir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc -C --build=x86
_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libico
nv-prefix --without-libintl-prefix --enable-shared --enable-shared-libgcc --enab
le-static --enable-version-specific-runtime-libs --enable-bootstrap --disable-__
cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=c,c++,fortran,lt
o,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --ena
ble-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support -
-enable-libssp --enable-libgcj-sublibs --disable-java-awt --disable-symvers --wi
th-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-incl
ude=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --
with-system-zlib
Thread model: posix
gcc version 4.8.2 (GCC)


sunyc@sunyc-wks ~
$ cat 1.cc
#include stdio.h

int main() {
 char out[255];
 snprintf(out, sizeof(out), %d, 1);
 return 1;
}

sunyc@sunyc-wks ~
$ g++ --std=c++11 1.cc
1.cc: In function ‘int main()’:
1.cc:5:36: error: ‘snprintf’ was not declared in this scope
  snprintf(out, sizeof(out), %d, 1);
^

sunyc@sunyc-wks ~
$ g++ --std=gnu++0x 1.cc

sunyc@sunyc-wks ~
$ ls -lah a.exe
-rwxr-xr-x 1 sunyc None 62K Nov 12 10:21 a.exe

Cheers.

On Tue, Nov 12, 2013 at 1:45 AM, JonY 10wa...@gmail.com wrote:
 On 11/12/2013 10:33, Yucong Sun wrote:
 I've tried on both 32bit and 64bit clean cygwin install, the result is
 same. Something is wrong with cygwin's gcc.

 my configure script by default uses g++ --std=c++11, this still have
 problem of  no snprintf  , after I replace all snprintf() with
 sprintf() , I've met the same linkage problem again.


 Something else is very wrong.

 g++ --std=gnu++0x fixes the snprintf problem, but it still have same
 linkage problem.


 Please make a minimalist case, I've tried some basic C++11 features but
 I don't get such errors.



--
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



Re: C++11 program link failure under GCC 4.8.2-1

2013-11-12 Thread JonY
On 11/13/2013 02:35, Yucong Sun wrote:
 Good new! I've found the link failure issue, it is caused by  -rdynamic
 
 sunyc@sunyc-wks ~
 $ cat 2.cc
 #include deque
 
 struct tick_event {
 int i;
 };
 
 int main() {
 std::dequetick_event * list;
 
 tick_event *a = new tick_event;
 list.push_back(a);
 return 0;
 }
 
 sunyc@sunyc-wks ~
 $ g++ -c --std=c++11 -O3 -flto 2.cc -o 2.o
 
 sunyc@sunyc-wks ~
 $ g++ --std=c++11 -flto -D_GNU_SOURCE -rdynamic -fno-omit-frame-pointer 
 -D_GNU_
 SOURCE -march=native  -O3 2.o -o a
 Cannot export 
 _ZNSt5dequeIP10tick_eventSaIS1_EE16_M_push_back_auxIJRKS1_EEEvDpOT
 _: symbol wrong type (4 vs 3)
 collect2: error: ld returned 1 exit status
 
 
 sunyc@sunyc-wks ~
 $ g++ --std=c++11 -flto -D_GNU_SOURCE -fno-omit-frame-pointer -D_GNU_SOURCE 
 -ma
 rch=native  -O3 2.o -o a
 
 sunyc@sunyc-wks ~
 $
 
 Hope it would help you nail the problem.
 

-rdynamic shouldn't do anything on Windows, I guess using ELF specific
arguments can break things.
 
 And Here's the test case for snprintf  c++11
 
 $ gcc -v
 Using built-in specs.
 COLLECT_GCC=gcc
 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-cygwin/4.8.2/lto-wrapper.exe
 Target: x86_64-pc-cygwin
 Configured with: 
 /cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2/co
 nfigure --srcdir=/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2 
 --
 prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin 
 --libexecdi
 r=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc 
 --lib
 dir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc -C 
 --build=x86
 _64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin 
 --without-libico
 nv-prefix --without-libintl-prefix --enable-shared --enable-shared-libgcc 
 --enab
 le-static --enable-version-specific-runtime-libs --enable-bootstrap 
 --disable-__
 cxa_atexit --with-dwarf2 --with-tune=generic 
 --enable-languages=c,c++,fortran,lt
 o,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic 
 --ena
 ble-libgomp --disable-libitm --enable-libquadmath 
 --enable-libquadmath-support -
 -enable-libssp --enable-libgcj-sublibs --disable-java-awt --disable-symvers 
 --wi
 th-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as 
 --with-cloog-incl
 ude=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix 
 --
 with-system-zlib
 Thread model: posix
 gcc version 4.8.2 (GCC)
 
 
 sunyc@sunyc-wks ~
 $ cat 1.cc
 #include stdio.h
 
 int main() {
  char out[255];
  snprintf(out, sizeof(out), %d, 1);
  return 1;
 }
 
 sunyc@sunyc-wks ~
 $ g++ --std=c++11 1.cc
 1.cc: In function ‘int main()’:
 1.cc:5:36: error: ‘snprintf’ was not declared in this scope
   snprintf(out, sizeof(out), %d, 1);
 ^
 
 sunyc@sunyc-wks ~
 $ g++ --std=gnu++0x 1.cc
 
 sunyc@sunyc-wks ~
 $ ls -lah a.exe
 -rwxr-xr-x 1 sunyc None 62K Nov 12 10:21 a.exe
 
 Cheers.
 

Right now, it is guarded by:
#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ = 199901L)

Which means non-strict mode and C99 mode, snprintf was not part of
C++03. I guess (__cplusplus = 201103L) needs to be added to newlib.




signature.asc
Description: OpenPGP digital signature


Re: C++11 program link failure under GCC 4.8.2-1

2013-11-12 Thread Ryan Johnson

On 12/11/2013 5:30 PM, JonY wrote:

On 11/13/2013 02:35, Yucong Sun wrote:

Good new! I've found the link failure issue, it is caused by  -rdynamic

sunyc@sunyc-wks ~
$ cat 2.cc
#include deque

struct tick_event {
 int i;
};

int main() {
 std::dequetick_event * list;

 tick_event *a = new tick_event;
 list.push_back(a);
 return 0;
}

sunyc@sunyc-wks ~
$ g++ -c --std=c++11 -O3 -flto 2.cc -o 2.o

sunyc@sunyc-wks ~
$ g++ --std=c++11 -flto -D_GNU_SOURCE -rdynamic -fno-omit-frame-pointer -D_GNU_
SOURCE -march=native  -O3 2.o -o a
Cannot export _ZNSt5dequeIP10tick_eventSaIS1_EE16_M_push_back_auxIJRKS1_EEEvDpOT
_: symbol wrong type (4 vs 3)
collect2: error: ld returned 1 exit status


sunyc@sunyc-wks ~
$ g++ --std=c++11 -flto -D_GNU_SOURCE -fno-omit-frame-pointer -D_GNU_SOURCE -ma
rch=native  -O3 2.o -o a

sunyc@sunyc-wks ~
$

Hope it would help you nail the problem.


-rdynamic shouldn't do anything on Windows, I guess using ELF specific
arguments can break things.

And Here's the test case for snprintf  c++11

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-cygwin/4.8.2/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2/co
nfigure --srcdir=/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2 --
prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdi
r=/usr/libexec --datadir=/usr/share --localstatedir=/var --sysconfdir=/etc --lib
dir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc -C --build=x86
_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libico
nv-prefix --without-libintl-prefix --enable-shared --enable-shared-libgcc --enab
le-static --enable-version-specific-runtime-libs --enable-bootstrap --disable-__
cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=c,c++,fortran,lt
o,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --ena
ble-libgomp --disable-libitm --enable-libquadmath --enable-libquadmath-support -
-enable-libssp --enable-libgcj-sublibs --disable-java-awt --disable-symvers --wi
th-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as --with-cloog-incl
ude=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --
with-system-zlib
Thread model: posix
gcc version 4.8.2 (GCC)


sunyc@sunyc-wks ~
$ cat 1.cc
#include stdio.h

int main() {
  char out[255];
  snprintf(out, sizeof(out), %d, 1);
  return 1;
}

sunyc@sunyc-wks ~
$ g++ --std=c++11 1.cc
1.cc: In function ‘int main()’:
1.cc:5:36: error: ‘snprintf’ was not declared in this scope
   snprintf(out, sizeof(out), %d, 1);
 ^

sunyc@sunyc-wks ~
$ g++ --std=gnu++0x 1.cc

sunyc@sunyc-wks ~
$ ls -lah a.exe
-rwxr-xr-x 1 sunyc None 62K Nov 12 10:21 a.exe

Cheers.


Right now, it is guarded by:
#if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ = 199901L)

Which means non-strict mode and C99 mode, snprintf was not part of
C++03. I guess (__cplusplus = 201103L) needs to be added to newlib.
Yes, this has come up before [1]. Several *printf variants are affected 
IIRC.


[1] http://cygwin.com/ml/cygwin/2012-04/msg00140.html

Ryan


--
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



Re: C++11 program link failure under GCC 4.8.2-1

2013-11-12 Thread Yucong Sun
That's what lead me to use gnu++0x instead.

For -rdynamic, apparently it would work for some simple c++ program,
just not those with new c++11 features. It would be nice to fix it.

Cheers.

On Tue, Nov 12, 2013 at 3:37 PM, Ryan Johnson
ryan.john...@cs.utoronto.ca wrote:
 On 12/11/2013 5:30 PM, JonY wrote:

 On 11/13/2013 02:35, Yucong Sun wrote:

 Good new! I've found the link failure issue, it is caused by  -rdynamic

 sunyc@sunyc-wks ~
 $ cat 2.cc
 #include deque

 struct tick_event {
  int i;
 };

 int main() {
  std::dequetick_event * list;

  tick_event *a = new tick_event;
  list.push_back(a);
  return 0;
 }

 sunyc@sunyc-wks ~
 $ g++ -c --std=c++11 -O3 -flto 2.cc -o 2.o

 sunyc@sunyc-wks ~
 $ g++ --std=c++11 -flto -D_GNU_SOURCE -rdynamic -fno-omit-frame-pointer
 -D_GNU_
 SOURCE -march=native  -O3 2.o -o a
 Cannot export
 _ZNSt5dequeIP10tick_eventSaIS1_EE16_M_push_back_auxIJRKS1_EEEvDpOT
 _: symbol wrong type (4 vs 3)
 collect2: error: ld returned 1 exit status


 sunyc@sunyc-wks ~
 $ g++ --std=c++11 -flto -D_GNU_SOURCE -fno-omit-frame-pointer
 -D_GNU_SOURCE -ma
 rch=native  -O3 2.o -o a

 sunyc@sunyc-wks ~
 $

 Hope it would help you nail the problem.

 -rdynamic shouldn't do anything on Windows, I guess using ELF specific
 arguments can break things.

 And Here's the test case for snprintf  c++11

 $ gcc -v
 Using built-in specs.
 COLLECT_GCC=gcc

 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-cygwin/4.8.2/lto-wrapper.exe
 Target: x86_64-pc-cygwin
 Configured with:
 /cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2/co
 nfigure
 --srcdir=/cygdrive/i/szsz/tmpp/cygwin64/gcc/gcc-4.8.2-1/src/gcc-4.8.2 --
 prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin
 --libexecdi
 r=/usr/libexec --datadir=/usr/share --localstatedir=/var
 --sysconfdir=/etc --lib
 dir=/usr/lib --datarootdir=/usr/share --docdir=/usr/share/doc/gcc -C
 --build=x86
 _64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin
 --without-libico
 nv-prefix --without-libintl-prefix --enable-shared --enable-shared-libgcc
 --enab
 le-static --enable-version-specific-runtime-libs --enable-bootstrap
 --disable-__
 cxa_atexit --with-dwarf2 --with-tune=generic
 --enable-languages=c,c++,fortran,lt
 o,objc,obj-c++ --enable-graphite --enable-threads=posix
 --enable-libatomic --ena
 ble-libgomp --disable-libitm --enable-libquadmath
 --enable-libquadmath-support -
 -enable-libssp --enable-libgcj-sublibs --disable-java-awt
 --disable-symvers --wi
 th-ecj-jar=/usr/share/java/ecj.jar --with-gnu-ld --with-gnu-as
 --with-cloog-incl
 ude=/usr/include/cloog-isl --without-libiconv-prefix
 --without-libintl-prefix --
 with-system-zlib
 Thread model: posix
 gcc version 4.8.2 (GCC)


 sunyc@sunyc-wks ~
 $ cat 1.cc
 #include stdio.h

 int main() {
   char out[255];
   snprintf(out, sizeof(out), %d, 1);
   return 1;
 }

 sunyc@sunyc-wks ~
 $ g++ --std=c++11 1.cc
 1.cc: In function ‘int main()’:
 1.cc:5:36: error: ‘snprintf’ was not declared in this scope
snprintf(out, sizeof(out), %d, 1);
  ^

 sunyc@sunyc-wks ~
 $ g++ --std=gnu++0x 1.cc

 sunyc@sunyc-wks ~
 $ ls -lah a.exe
 -rwxr-xr-x 1 sunyc None 62K Nov 12 10:21 a.exe

 Cheers.

 Right now, it is guarded by:
 #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ = 199901L)

 Which means non-strict mode and C99 mode, snprintf was not part of
 C++03. I guess (__cplusplus = 201103L) needs to be added to newlib.

 Yes, this has come up before [1]. Several *printf variants are affected
 IIRC.

 [1] http://cygwin.com/ml/cygwin/2012-04/msg00140.html

 Ryan


 --
 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


--
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



Re: C++11 program link failure under GCC 4.8.2-1

2013-11-11 Thread JonY
On 11/12/2013 06:17, JonY wrote:
 On 11/12/2013 05:17, Yucong Sun wrote:
 Hi,

 I'm trying to compile a program under cygwin with latest gcc 4.8.2,
 the program compiles fine, but link failed. I'm suspecting this has
 something todo with libstdc++ but I couldn't find any document on how
 to check libstdc++ version (cygwin setup claim it is version 4.8.2
 already).

 
 I'm not sure either, could you ask gcc-help instead?
 
 

963e2a697c3a1a7d036d975b07f4c408bbd1cb2d *libstdc++.dll.a
f4dfadfddade3aceaf4852cd5db31372ab7ef0d1 *libstdc++.a

Is your sha1sum matching mine for 4.8.2?




signature.asc
Description: OpenPGP digital signature


Re: C++11 program link failure under GCC 4.8.2-1

2013-11-11 Thread Yucong Sun
Yes, the sha1 matches.

sunyc@sunyc-wks /lib/gcc/i686-pc-cygwin/4.8.2
$ sha1sum.exe libstdc++.*
f4dfadfddade3aceaf4852cd5db31372ab7ef0d1 *libstdc++.a
963e2a697c3a1a7d036d975b07f4c408bbd1cb2d *libstdc++.dll.a

Also I couldn't find GLIB_xxx version number in libstdc++.a

sunyc@sunyc-wks /lib/gcc/i686-pc-cygwin/4.8.2
$ strings.exe libstdc++.a | grep GLIB
GLIBCXX_FORCE_NEW
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH

Cheers.

On Mon, Nov 11, 2013 at 2:28 PM, JonY 10wa...@gmail.com wrote:
 On 11/12/2013 06:17, JonY wrote:
 On 11/12/2013 05:17, Yucong Sun wrote:
 Hi,

 I'm trying to compile a program under cygwin with latest gcc 4.8.2,
 the program compiles fine, but link failed. I'm suspecting this has
 something todo with libstdc++ but I couldn't find any document on how
 to check libstdc++ version (cygwin setup claim it is version 4.8.2
 already).


 I'm not sure either, could you ask gcc-help instead?



 963e2a697c3a1a7d036d975b07f4c408bbd1cb2d *libstdc++.dll.a
 f4dfadfddade3aceaf4852cd5db31372ab7ef0d1 *libstdc++.a

 Is your sha1sum matching mine for 4.8.2?



--
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



Re: C++11 program link failure under GCC 4.8.2-1

2013-11-11 Thread Yucong Sun
I've tried on both 32bit and 64bit clean cygwin install, the result is
same. Something is wrong with cygwin's gcc.

my configure script by default uses g++ --std=c++11, this still have
problem of  no snprintf  , after I replace all snprintf() with
sprintf() , I've met the same linkage problem again.

g++ --std=gnu++0x fixes the snprintf problem, but it still have same
linkage problem.

Any help will be much appreciated.

Cheers.

On Mon, Nov 11, 2013 at 3:37 PM, Yucong Sun sunyuc...@gmail.com wrote:
 Yes, the sha1 matches.

 sunyc@sunyc-wks /lib/gcc/i686-pc-cygwin/4.8.2
 $ sha1sum.exe libstdc++.*
 f4dfadfddade3aceaf4852cd5db31372ab7ef0d1 *libstdc++.a
 963e2a697c3a1a7d036d975b07f4c408bbd1cb2d *libstdc++.dll.a

 Also I couldn't find GLIB_xxx version number in libstdc++.a

 sunyc@sunyc-wks /lib/gcc/i686-pc-cygwin/4.8.2
 $ strings.exe libstdc++.a | grep GLIB
 GLIBCXX_FORCE_NEW
 GLIBCXX_FORCE_NEW
 GLIBCXX_DEBUG_MESSAGE_LENGTH

 Cheers.

 On Mon, Nov 11, 2013 at 2:28 PM, JonY 10wa...@gmail.com wrote:
 On 11/12/2013 06:17, JonY wrote:
 On 11/12/2013 05:17, Yucong Sun wrote:
 Hi,

 I'm trying to compile a program under cygwin with latest gcc 4.8.2,
 the program compiles fine, but link failed. I'm suspecting this has
 something todo with libstdc++ but I couldn't find any document on how
 to check libstdc++ version (cygwin setup claim it is version 4.8.2
 already).


 I'm not sure either, could you ask gcc-help instead?



 963e2a697c3a1a7d036d975b07f4c408bbd1cb2d *libstdc++.dll.a
 f4dfadfddade3aceaf4852cd5db31372ab7ef0d1 *libstdc++.a

 Is your sha1sum matching mine for 4.8.2?



--
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



Re: C++11 program link failure under GCC 4.8.2-1

2013-11-11 Thread Yucong Sun
(forgot to say)

this program compile and links fine on g++ 4.6 ,4.7, 4.8 on ubuntu
,centos, freebsd etc without modification.

Cheers.

On Mon, Nov 11, 2013 at 6:33 PM, Yucong Sun sunyuc...@gmail.com wrote:
 I've tried on both 32bit and 64bit clean cygwin install, the result is
 same. Something is wrong with cygwin's gcc.

 my configure script by default uses g++ --std=c++11, this still have
 problem of  no snprintf  , after I replace all snprintf() with
 sprintf() , I've met the same linkage problem again.

 g++ --std=gnu++0x fixes the snprintf problem, but it still have same
 linkage problem.

 Any help will be much appreciated.

 Cheers.

 On Mon, Nov 11, 2013 at 3:37 PM, Yucong Sun sunyuc...@gmail.com wrote:
 Yes, the sha1 matches.

 sunyc@sunyc-wks /lib/gcc/i686-pc-cygwin/4.8.2
 $ sha1sum.exe libstdc++.*
 f4dfadfddade3aceaf4852cd5db31372ab7ef0d1 *libstdc++.a
 963e2a697c3a1a7d036d975b07f4c408bbd1cb2d *libstdc++.dll.a

 Also I couldn't find GLIB_xxx version number in libstdc++.a

 sunyc@sunyc-wks /lib/gcc/i686-pc-cygwin/4.8.2
 $ strings.exe libstdc++.a | grep GLIB
 GLIBCXX_FORCE_NEW
 GLIBCXX_FORCE_NEW
 GLIBCXX_DEBUG_MESSAGE_LENGTH

 Cheers.

 On Mon, Nov 11, 2013 at 2:28 PM, JonY 10wa...@gmail.com wrote:
 On 11/12/2013 06:17, JonY wrote:
 On 11/12/2013 05:17, Yucong Sun wrote:
 Hi,

 I'm trying to compile a program under cygwin with latest gcc 4.8.2,
 the program compiles fine, but link failed. I'm suspecting this has
 something todo with libstdc++ but I couldn't find any document on how
 to check libstdc++ version (cygwin setup claim it is version 4.8.2
 already).


 I'm not sure either, could you ask gcc-help instead?



 963e2a697c3a1a7d036d975b07f4c408bbd1cb2d *libstdc++.dll.a
 f4dfadfddade3aceaf4852cd5db31372ab7ef0d1 *libstdc++.a

 Is your sha1sum matching mine for 4.8.2?



--
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