Boost logo

Boost Users :

From: Martin Cavanagh (mac24nz_at_[hidden])
Date: 2005-08-27 17:13:36


Hi everyone. I want to show my extreme newbieness.

I can't compile the BASIC thread examples. I get lots of link errors

http://www-eleves-isia.cma.fr/documentation/BoostDoc/boost_1_29_0/libs/thread/example/thread.cpp

I'm running Windows XP SP2 with mingw (which compiles everything else in
my project fine

g++ -IC:/Boost/include/boost-1_32 -LC:/Boost/lib -lboost_thread-mgw-mt
thread_test.cpp

It definitely finds the library (when i miss type it it throws a
different error)

C:/DOKUME~1/Marty/LOKALE~1/Temp/cc8Yaaaa.o(.text+0x1ce): In function `main':
c:/webcam/thread_test.cpp:27: undefined reference to
`_imp___ZN5boost6threadC1ERKNS_9function0IvSaINS_13function_baseEEEE'
C:/DOKUME~1/Marty/LOKALE~1/Temp/cc8Yaaaa.o(.text+0x235):c:/webcam/thread_test.cpp:28:
undefined reference to `_imp___ZN5boost6thread4joinEv'
C:/DOKUME~1/Marty/LOKALE~1/Temp/cc8Yaaaa.o(.text+0x26b):c:/webcam/thread_test.cpp:28:
undefined reference to `_imp___ZN5boost6threadD1Ev'
C:/DOKUME~1/Marty/LOKALE~1/Temp/cc8Yaaaa.o(.text+0x2a0):c:/webcam/thread_test.cpp:28:
undefined reference to `_imp___ZN5boost6threadD1Ev'
C:/DOKUME~1/Marty/LOKALE~1/Temp/cc8Yaaaa.o(.text$_ZN12thread_alarmclEv[thread_alarm::operator()()]+0x15):
In function `ZN9__gnu_cxx13new_allocatorI12thread_alarmE7destroyEPS1_':
c:/msys/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/ext/new_allocator.h:
undefined reference to `_imp___ZN5boost9xtime_getEPNS_5xtimeEi'
C:/DOKUME~1/Marty/LOKALE~1/Temp/cc8Yaaaa.o(.text$_ZN12thread_alarmclEv[thread_alarm::operator()()]+0x36):c:/msys/MinGW/bin/../lib/gcc/mingw32/3.4.2/../../../../include/c++/3.4.2/ext/new_allocator.h:
undefined reference to `_imp___ZN5boost6thread5sleepERKNS_5xtimeE'
collect2: ld returned 1 exit status

But when I run it as 2 commands:
g++ -IC:/Boost/include/boost-1_32 thread_test.cpp -o thread_test.o -c
g++ -LC:/Boost/lib -o manual_test thread_test.o -lboost_thread-mgw-mt

It compiles perfectly, no warnings or anything

$ manual_test.exe
setting alarm for 5 seconds...
alarm sounded...

is there some rule, for producing executables from librarys, that the
linking stage must be seperate????

Thanks

Martin
Send instant messages to your online friends http://au.messenger.yahoo.com


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net