From: JonY <jo...@us...> - 2012-10-11 22:00:44
|
On 10/12/2012 05:40, Jean-Claude Gervais wrote: > Hi, > > With MinGW, I've been able to build a DLL that used the STL in the past > but after updating to > > i686-pc-mingw32-g++ --version > i686-pc-mingw32-g++ (Gentoo 4.5.4 p1.0, pie-0.4.7) 4.5.4 > > I now get errors like this: > > i686-pc-mingw32-g++ -O2 -fno-strength-reduce -fno-strict-aliasing > -fno-exceptions -std=c++0x -Iinc -I../include > -I/usr/i686-pc-mingw32/usr/include -I/usr/i686-pc-mingw32/usr/include > -DWINDOWS -D_WINDOWS -DWIN32 -D_M_IX86 -Wall -c -o libmain.o > libmain.cpp > > i686-pc-mingw32-g++ -o ./libdbgtrace.so -shared -lstdc++ libmain.o > -lwsock32 -Wl,--no-undefined -Wl,-soname,libdbgtrace.so > libmain.o:libmain.cpp:(.text+0x80): undefined reference to `operator > delete(void*)' > libmain.o:libmain.cpp:(.text > $_ZNSt6vectorIcSaIcEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPcS1_EEjRKc[std::vector<char, std::allocator<char> >::_M_fill_insert(__gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > >, unsigned int, char const&)]+0x71): undefined reference to `operator new(unsigned int)' > libmain.o:libmain.cpp:(.text > $_ZNSt6vectorIcSaIcEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPcS1_EEjRKc[std::vector<char, std::allocator<char> >::_M_fill_insert(__gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > >, unsigned int, char const&)]+0xea): undefined reference to `operator delete(void*)' > libmain.o:libmain.cpp:(.text > $_ZNSt6vectorIcSaIcEE14_M_fill_insertEN9__gnu_cxx17__normal_iteratorIPcS1_EEjRKc[std::vector<char, std::allocator<char> >::_M_fill_insert(__gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char> > >, unsigned int, char const&)]+0x205): undefined reference to `std::__throw_length_error(char const*)' > > > I don't get it, the DLL compiled/linked/ran fine before and now after > updating I get this. > > Can someone please tell me what I am doing wrong? > Libraries ALWAYS after object, NEVER before. And no, don't argue about it, it has been this way since forever. libstdc++ is automatically linked anyway. i686-pc-mingw32-g++ -o ./libdbgtrace.so libmain.o -shared |