Probleme beim Einbinden der Boost libraries in den mingw compiler
-
Hi,
ich habe ein Problem mit den Libraries von Boost.
Hab mir die Sourcen besorgt und die .lib files gebaut. Die sind jetzt alle am Ordner C:\boost\lib. Die headers sind in C:\Boost\include\boost-1_33_1\boost. Soweit so gut.
Bei meinen Compileroptionen (ich benutze cdt für eclipse) hab ich nun C:\Boost\include\boost-1_33_1\boost beim comiler als zusätzliches include Verzeichniss angegeben und C:\boost\lib beim linker als zusätzlichen Suchpfad für Libraries.Zum Testen hab ich so ein 0815 programm hergenommen
#include <boost/thread/thread.hpp> #include <iostream> void helloworld() { std::cout << "Hello World!" << std::endl; } int main() { boost::thread thrd(&helloworld); thrd.join(); }
Die Header findet er. Compilen geht auch noch. Aber beim linken hörts auf.
**** Full rebuild of configuration Debug for project threadTest ****
mingw32-make -k clean all
rm -rf ./main.o ./main.d threadTest.exe
mingw32-make: [clean] Error 1 (ignored)
' '
'Building file: ../main.cpp'
'Invoking: GCC C++ Compiler'
g++ -I"C:\Boost\include\boost-1_33_1" -O0 -g3 -Wall -c -fmessage-length=0 -omain.o ../main.cpp
'Finished building: ../main.cpp'
' '
'Building target: threadTest.exe'
'Invoking: GCC C++ Linker'
g++ -L"C:\Boost\lib" -othreadTest.exe ./main.o
./main.o(.text+0x1c5): In functionmain': D:/Development/Dschinie/Eclipse Workspace/threadTest/Debug/../main.cpp:12: undefined reference to
boost::thread::thread(boost::function0<void, std::allocatorboost::function_base > const&)'
./main.o(.text+0x21b):D:/Development/Dschinie/Eclipse Workspace/threadTest/Debug/../main.cpp:13: undefined reference toboost::thread::join()' ./main.o(.text+0x246):D:/Development/Dschinie/Eclipse Workspace/threadTest/Debug/../main.cpp:13: undefined reference to
boost::thread::~thread()'
./main.o(.text+0x270):D:/Development/Dschinie/Eclipse Workspace/threadTest/Debug/../main.cpp:13: undefined reference toboost::thread::~thread()' collect2: ld returned 1 exit status mingw32-make: *** [threadTest.exe] Error 1 mingw32-make: Target
all' not remade because of errors.
Build complete for project threadTestHat da jemand ne Idee?
Die SuFu hat mir zwar 269 Treffer zum Thema boost gezeigt, allerdings gehts in den meisten Threads darum boost überhaupt erst zu bauen.Gruss
Ironeagle
-
Naja, ich würde noch die Libdateien bekannt geben. Schön und gut das er weiß wo das Lib-Verzeichnis liegt, die eigentlichen Libs und DLLs mußt du ihm mitgeben. Füg die Libs doch einfach in den Projektproperties unter GCC Linker->Libraries hinzu.
Die Libs autom. finden kann glaub ich nur VC++. Da reicht tatsächlich das Lib-Verzeichnis.
-
hi
das hab ich auch schon mal probiert. Da meckert er dann aber, dass er die Datei nicht findet'Invoking: GCC C++ Linker'
g++ -L"C:\Boost\lib" -othreadTest.exe ./main.o -lC:\boost\lib\libboost_thread-mgw-mt-s.lib
C:\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lC:\boost\lib\libboost_thread-mgw-mt-s.lib
collect2: ld returned 1 exit statusich habs auch schon mit slashes anstatt backslashes probiert.