Arter installing i686-pc-mingw32 with crossdev I try to compile helloworld.cpp and linkage fails with next error next error: $ i686-pc-mingw32-g++ -c helloworld.cpp $ i686-pc-mingw32-g++ helloworld.o /tmp/ccLGjfxr.o:helloworld.cpp:(.text+0x19): undefined reference to `std::cout' /tmp/ccLGjfxr.o:helloworld.cpp:(.text+0x1e): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)' /tmp/ccLGjfxr.o:helloworld.cpp:(.text+0x26): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)' /tmp/ccLGjfxr.o:helloworld.cpp:(.text+0x2e): undefined reference to `std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))' /tmp/ccLGjfxr.o:helloworld.cpp:(.text+0x47): undefined reference to `std::ios_base::Init::~Init()' /tmp/ccLGjfxr.o:helloworld.cpp:(.text+0x6a): undefined reference to `std::ios_base::Init::Init()' collect2: ld returned 1 exit status Reproducible: Always Steps to Reproduce: 1.# crossdev --stable --target i686-pc-mingw32 2.$ i686-pc-mingw32-g++ -c helloworld.cpp 3.$ i686-pc-mingw32-g++ helloworld.o Actual Results: Linkage fails, can't find STL objects Expected Results: Linkage success Installation logs of mingw32 toolchain are attached
Created attachment 311227 [details] i686-pc-mingw32-logs.tar.bz2
Created attachment 311229 [details] emerge-info
Created attachment 311231 [details] helloworld.cpp
works fine for me # qlist -Iv cross-i686-pc-mingw32 cross-i686-pc-mingw32/binutils-2.22-r1 cross-i686-pc-mingw32/gcc-4.5.3-r2 cross-i686-pc-mingw32/mingw-runtime-3.18 cross-i686-pc-mingw32/w32api-3.17.2 # i686-pc-mingw32-g++ -c helloworld.cpp # i686-pc-mingw32-g++ helloworld.o # file a.exe a.exe: PE32 executable (console) Intel 80386, for MS Windows try running the command: # i686-pc-mingw32-g++ helloworld.o -v -Wl,--verbose |& grep stdc /usr/libexec/gcc/i686-pc-mingw32/4.5.3/collect2 --sysroot=/usr/i686-pc-mingw32 -Bdynamic /usr/i686-pc-mingw32/mingw/lib/crt2.o /usr/lib/gcc/i686-pc-mingw32/4.5.3/crtbegin.o -L/usr/lib/gcc/i686-pc-mingw32/4.5.3 -L/usr/i686-pc-mingw32/mingw/lib helloworld.o --verbose -lstdc++ -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt /usr/lib/gcc/i686-pc-mingw32/4.5.3/crtend.o attempt to open /usr/lib/gcc/i686-pc-mingw32/4.5.3/libstdc++.dll.a succeeded (/usr/lib/gcc/i686-pc-mingw32/4.5.3/libstdc++.dll.a)d002780.o (/usr/lib/gcc/i686-pc-mingw32/4.5.3/libstdc++.dll.a)d002781.o (/usr/lib/gcc/i686-pc-mingw32/4.5.3/libstdc++.dll.a)d002858.o (/usr/lib/gcc/i686-pc-mingw32/4.5.3/libstdc++.dll.a)d000982.o (/usr/lib/gcc/i686-pc-mingw32/4.5.3/libstdc++.dll.a)d002516.o (/usr/lib/gcc/i686-pc-mingw32/4.5.3/libstdc++.dll.a)d002514.o (/usr/lib/gcc/i686-pc-mingw32/4.5.3/libstdc++.dll.a)d000000.o (/usr/lib/gcc/i686-pc-mingw32/4.5.3/libstdc++.dll.a)d003506.o
Created attachment 311457 [details] link.log full output of # i686-pc-mingw32-g++ helloworld.o -v -Wl,--verbose
(In reply to comment #4) Works correctly on my x86 PC and produces error on amd64 laptop. On which architecture you run it?
my amd64 desktop
Works fine after upgrade to gcc-4.6.3
I had such problems when I had two migw32-g++ installed: 4.5 (active) and 4.7. For some reason 4.5 had empty libstdc++. 4.6.3 seems to produce binaries, but they are broken. Even simple <iostream>y "hello world" produced by 4.6.3 dies before main() (somewhere in sjlj.dll loader). Binaried built winh 4.7.1 look and run fine.