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]

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

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

sunyc@sunyc-wks ~
$ cat
#include <deque>

struct tick_event {
    int i;

int main() {
    std::deque<tick_event *> list;

    tick_event *a = new tick_event;
    return 0;

sunyc@sunyc-wks ~
$ g++ -c --std=c++11 -O3 -flto -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.
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 --
Thread model: posix
gcc version 4.8.2 (GCC)

sunyc@sunyc-wks ~
$ cat
#include <stdio.h>

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

sunyc@sunyc-wks ~
$ g++ --std=c++11 In function âint main()â: error: âsnprintfâ was not declared in this scope
  snprintf(out, sizeof(out), "%d", 1);

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

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


On Tue, Nov 12, 2013 at 1:45 AM, JonY <> 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:
Unsubscribe info:

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