Boost logo

Boost Users :

Subject: Re: [Boost-users] boost:thread compiling problem
From: Michael Caisse (boost_at_[hidden])
Date: 2009-08-21 22:45:42


Shaolin wrote:
> Ok, the lib issues have been fixed. I have configured it all properly
> and I am not longer getting the 'dir not found errors'. I am alas
> getting a new error.
>
> // This is what I enter in commandline
> $ g++ -I /usr/local/boost_1_39_0 filereader.cc -o fr
> -L~/usr/local/boost_1_39_0/boost/stage/lib/libboost_thread-gcc43-mt-1_39.a
>
> // ERROR MSG:
> /tmp/ccv0fHxn.o: In function `main':
> filereader.cc:(.text+0x3f0): undefined reference to
> `boost::thread::~thread()'
> /tmp/ccv0fHxn.o: In function `boost::mutex::mutex()':
> filereader.cc:(.text._ZN5boost5mutexC1Ev[boost::mutex::mutex()]+0x45):
> undefined reference to
> `boost::thread_resource_error::thread_resource_error()'
> filereader.cc:(.text._ZN5boost5mutexC1Ev[boost::mutex::mutex()]+0x4d):
> undefined reference to
> `boost::thread_resource_error::~thread_resource_error()'
> filereader.cc:(.text._ZN5boost5mutexC1Ev[boost::mutex::mutex()]+0x55):
> undefined reference to `typeinfo for boost::thread_resource_error'
> /tmp/ccv0fHxn.o: In function `boost::detail::thread_data<void
> (*)()>::~thread_data()':
> filereader.cc:(.text._ZN5boost6detail11thread_dataIPFvvEED0Ev[boost::detail::thread_data<void
> (*)()>::~thread_data()]+0x16): undefined reference to
> `boost::detail::thread_data_base::~thread_data_base()'
> /tmp/ccv0fHxn.o: In function `boost::detail::thread_data<void
> (*)()>::~thread_data()':
> filereader.cc:(.text._ZN5boost6detail11thread_dataIPFvvEED1Ev[boost::detail::thread_data<void
> (*)()>::~thread_data()]+0x16): undefined reference to
> `boost::detail::thread_data_base::~thread_data_base()'
> /tmp/ccv0fHxn.o: In function
> `boost::condition_variable::condition_variable()':
> filereader.cc:(.text._ZN5boost18condition_variableC1Ev[boost::condition_variable::condition_variable()]+0x3a):
> undefined reference to
> `boost::thread_resource_error::thread_resource_error()'
> filereader.cc:(.text._ZN5boost18condition_variableC1Ev[boost::condition_variable::condition_variable()]+0x42):
> undefined reference to
> `boost::thread_resource_error::~thread_resource_error()'
> filereader.cc:(.text._ZN5boost18condition_variableC1Ev[boost::condition_variable::condition_variable()]+0x4a):
> undefined reference to `typeinfo for boost::thread_resource_error'
> /tmp/ccv0fHxn.o: In function
> `boost::detail::thread_data_base::thread_data_base()':
> filereader.cc:(.text._ZN5boost6detail16thread_data_baseC2Ev[boost::detail::thread_data_base::thread_data_base()]+0x1b):
> undefined reference to `vtable for boost::detail::thread_data_base'
> /tmp/ccv0fHxn.o: In function `boost::thread::thread<void (*)()>(void
> (*)(), boost::disable_if<boost::is_convertible<void (*&)(),
> boost::detail::thread_move_t<void (*)()> >,
> boost::thread::dummy*>::type)':
> filereader.cc:(.text._ZN5boost6threadC1IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE[boost::thread::thread<void
> (*)()>(void (*)(), boost::disable_if<boost::is_convertible<void
> (*&)(), boost::detail::thread_move_t<void (*)()> >,
> boost::thread::dummy*>::type)]+0x32): undefined reference to
> `boost::thread::start_thread()'
> /tmp/ccv0fHxn.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[typeinfo
> for boost::detail::thread_data<void (*)()>]+0x8): undefined reference
> to `typeinfo for boost::detail::thread_data_base'
> collect2: ld returned 1 exit status
>
>
You are still not using your tools correctly. -L is for specifying a directory location.
The errors you are getting are because you are not linking the thread library.

Let me suggest that you take some time with a simple non-boost example and learn how the
compiler and linker work. The problems you are having are simply because you do not
understand your tools. I am sure there must be some good tutorials on basic compiling/linking
somewhere on the web.

Good luck
Michael

-- 
----------------------------------
Michael Caisse
Object Modeling Designs
www.objectmodelingdesigns.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