2012-04-05 4 views
0

Ich habe Boost bereits konfiguriert, aber dieses Mal habe ich keine Ahnung, was das Problem verursacht. Ich habe einige Screenshots mit meinen Einstellungen in CodeBlocks (svn7550) zur Verfügung gestellt. Ich habe meine Boost-Bibliothek mit diesen Befehlen erstellt.Probleme bei der Konfiguration von Boost mit Codeblöcken

Boost F:\ und Hauptordner Adresse extrahiert wird, ist:

F:\boost_1_49_0 

Hier sind die Befehle:

F:\ 
F:\ cd Boost_1_44_0 
F:\ Boost_1_44_0> bootstrap.bat 
F:\ Boost_1_44_0>bjam toolset=gcc --build-type=complete stage 

Die oben zu tun hat nicht gut, so schrieb ich dieses und tatsächlich gut kompiliert:

F:\ Boost_1_44_0>bjam variant=debug,release link=static address-model=32 

und dann

F:\boost_1_49_0>bjam toolset=gcc variant=debug,release link=static threading=multi address-model=32 --build-type=complete stage 

dann, wenn ich einen Thread Beispiel zu kompilieren versucht:

#include <boost/thread.hpp> 
#include <iostream> 

void wait(int seconds) 
{ 
    boost::this_thread::sleep(boost::posix_time::seconds(seconds)); 
} 

boost::mutex mutex; 

void thread() 
{ 
    for (int i = 0; i < 5; ++i) 
    { 
    wait(1); 
    mutex.lock(); 
    std::cout << "Thread " << boost::this_thread::get_id() << ": " << i << std::endl; 
    mutex.unlock(); 
    } 
} 

int main() 
{ 
    boost::thread t1(thread); 
    boost::thread t2(thread); 
    t1.join(); 
    t2.join(); 
} 

es mit diesen Fehlern fehlgeschlagen:

||=== Boost Example, Debug ===| 
obj\Debug\main.o||In function `Z6threadv':| 
D:\Documents and Settings\Master\My Documents\Projects\Boost Example\main.cpp|18|undefined reference to `_imp___ZN5boost11this_thread6get_idEv'| 
obj\Debug\main.o||In function `main':| 
D:\Documents and Settings\Master\My Documents\Projects\Boost Example\main.cpp|27|undefined reference to `_imp___ZN5boost6thread4joinEv'| 
D:\Documents and Settings\Master\My Documents\Projects\Boost Example\main.cpp|28|undefined reference to `_imp___ZN5boost6thread4joinEv'| 
D:\Documents and Settings\Master\My Documents\Projects\Boost Example\main.cpp|28|undefined reference to `_imp___ZN5boost6threadD1Ev'| 
D:\Documents and Settings\Master\My Documents\Projects\Boost Example\main.cpp|28|undefined reference to `_imp___ZN5boost6threadD1Ev'| 
D:\Documents and Settings\Master\My Documents\Projects\Boost Example\main.cpp|28|undefined reference to `_imp___ZN5boost6threadD1Ev'| 
D:\Documents and Settings\Master\My Documents\Projects\Boost Example\main.cpp|28|undefined reference to `_imp___ZN5boost6threadD1Ev'| 
F:\boost_1_49_0\boost\thread\win32\thread_data.hpp|161|undefined reference to `_imp___ZN5boost11this_thread18interruptible_waitEPvNS_6detail7timeoutE'| 
obj\Debug\main.o||In function `thread<void (*)()>':| 
F:\boost_1_49_0\boost\thread\detail\thread.hpp|205|undefined reference to `_imp___ZN5boost6thread12start_threadEv'| 
||=== Build finished: 9 errors, 0 warnings (0 minutes, 58 seconds) ===| 

Während der Faden Beispiel oben ausfällt, dieser Ausschnitt Kompiliert gerade fein:

#include <boost/lambda/lambda.hpp> 
#include <iostream> 
#include <iterator> 
#include <algorithm> 

int main() 
{ 
    using namespace boost::lambda; 
    typedef std::istream_iterator<int> in; 

    std::for_each(
     in(std::cin), in(), std::cout << (_1 * 3) << " "); 
} 

und das ist mein CB screenshots im Moment:

http://upload.ustmb.ir/uploads/13336039464.jpg

http://upload.ustmb.ir/uploads/13336039463.jpg

http://upload.ustmb.ir/uploads/13336039462.jpg

http://upload.ustmb.ir/uploads/13336039465.jpg

Und dies ist der Inhalt meiner Bühne/lib Ordner:

http://upload.ustmb.ir/uploads/13335642651.jpg

Würde mir jemand sagen, was das Problem ist?

Antwort

4

benutzte ich diesen Befehl Schub für die Erstellung:

F:\ 
F:\ cd Boost_1_44_0 
F:\ Boost_1_44_0> bootstrap.bat 
F:\ Boost_1_44_0>bjam toolset=gcc --build-type=complete stage variant=debug,release threading=multi link=static 

und der Rest der configs sind die gleichen. Ich folgte nur the guide here und fügte die:

#define BOOST_THREAD_USE_LIB 

in der ersten Zeile meines Quellcodes, und die Fehler sind verschwunden.

Verwandte Themen