|
Boost Users : |
From: David Walthall (walthall_at_[hidden])
Date: 2007-05-09 12:21:05
Carl Wainwright wrote:
> Hi all,
>
> I've started just recently to use boost in my C++ application to manage
> some threads. However, when I link my application I get strange
> undefined references
>
> g++ -g -O -o test_exe -lcppunit -ldl -lpthread -lboost_thread Main.o
> test.o
> test.o(.text+0x874): In function `threadTestCases::spawnThread()':
> : undefined reference to `boost::thread::thread(boost::function0<void,
> std::allocator<boost::function_base> > const&)'
> test.o(.text+0x8b7): In function `threadTestCases::spawnThread()':
> : undefined reference to `boost::thread::join()'
> test.o(.text+0x8ce): In function `threadTestCases::spawnThread()':
> : undefined reference to `boost::thread::~thread()'
> test.o(.text+0x8eb): In function `threadTestCases::spawnThread()':
> : undefined reference to `boost::thread::~thread()'
> collect2: ld returned 1 exit status
> make: *** [test_exe] Error 1
>
> As you can see I have linked in the boost_thread and pthread but still I
> get the problem. My LD_LIBRARY_PATH is correctly setup to define the
> path where boost is installed (/usr/lib/)
>
Hi Carl,
Try changing the order that you specify the arguments to g++. You'll
want to put Main.o and test.o before the request to link in the libraries.
Here is a link that has some more information (it is about DJGPP, but
should hold true for your version of g++):
http://www.delorie.com/djgpp/v2faq/faq8_10.html
David
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