Gentoo Forums
Gentoo Forums
Quick Search: in
Boost Threading Library
View unanswered posts
View posts from last 24 hours

rackathon
 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
richmastaplus
Tux's lil' helper
Tux's lil' helper


Joined: 29 Nov 2005
Posts: 127
Location: Canada

PostPosted: Wed Apr 12, 2006 7:26 am    Post subject: Boost Threading Library Reply with quote

Anybody have experience coding boost threads. I don't like pthreads because they are old school c and i need something more object oriented.

My problem is I get linker errors everytime I try to use them.

Other boost classes such as boost::shared_ptr work fine and I don't need to link to anything.

Any programmers who can help me?
Back to top
View user's profile Send private message
kmj0377
Guru
Guru


Joined: 26 Sep 2003
Posts: 396

PostPosted: Wed Apr 12, 2006 11:40 am    Post subject: Reply with quote

Well, most likely I think it's because you need -lboost_thread-mt
Back to top
View user's profile Send private message
xglad
n00b
n00b


Joined: 13 Aug 2002
Posts: 53
Location: Ft. Lauderdale, FL, USA.

PostPosted: Wed Apr 12, 2006 12:26 pm    Post subject: Re: Boost Threading Library Reply with quote

shared_ptr is a template implemented entirely in a header file. There is nothing to link.
Back to top
View user's profile Send private message
moocha
Veteran
Veteran


Joined: 21 Oct 2003
Posts: 5722
Location: Cluj-Napoca, Romania

PostPosted: Wed Apr 12, 2006 2:15 pm    Post subject: Reply with quote

It's probably a command line argument issue for the link command. Unlike most situations, the order of the object files and libraries on the linker command line is significant.
_________________
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Back to top
View user's profile Send private message
pgrdsl
Tux's lil' helper
Tux's lil' helper


Joined: 29 Aug 2002
Posts: 93
Location: Southampton, UK

PostPosted: Thu Apr 13, 2006 8:38 am    Post subject: Re: Boost Threading Library Reply with quote

richmastaplus wrote:
Anybody have experience coding boost threads. I don't like pthreads because they are old school c and i need something more object oriented.
My problem is I get linker errors everytime I try to use them.
Other boost classes such as boost::shared_ptr work fine and I don't need to link to anything.
Any programmers who can help me?

The other two answers are correct: most boost libraries are header only, but some end up requiring an extra library - Boost.Thread is one of them.
(Do ls /usr/lib/libboost*.so to find out all the others.)
You will also notice the "threads" and "threadsonly" USE flags for boost - make sure you at least have "threads" enabled, otherwise you won't get the -mt versions of the library, and you obviously won't get the boost threading libraries at all.
_________________
pihl
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum