help with boost thread compile
This might be very easy for a lot of you but I've been
banging my head on the wall.
I just installed the boost library and tried to run a
simple test file using boost.thread.mutex
#include
Sara Collins wrote:
I got this compilation error message: undefined reference to `boost::mutex::mutex[in-charge]()'
I guess I have to link in the libboost_thread.dll file somehow but I don't seem to find a solution how. Perharps I've been searching the wrong places.
Please help the newbie. Thanks a lot in advance.
It helps if you mention which compiler you are using as the how to link external libraries depend on that. -- -- Grafik - Don't Assume Anything -- Redshift Software, Inc. - http://redshift-software.com -- rrivera/acm.org - grafik/redshift-software.com - 102708583/icq
--- Rene Rivera wrote:
Sara Collins wrote:
I got this compilation error message: undefined reference to `boost::mutex::mutex[in-charge]()'
I guess I have to link in the libboost_thread.dll file somehow but I don't seem to find a solution how. Perharps I've been searching the wrong places.
Please help the newbie. Thanks a lot in advance.
It helps if you mention which compiler you are using as the how to link external libraries depend on that.
I'm using g++3.3.3 under cygwin (os windows 2000). I'm also planning to use Boost.Build to try out the build with both gcc and msvc7.1 toolset. _______________________________ Do you Yahoo!? Declare Yourself - Register online to vote today! http://vote.yahoo.com
On Fri, Oct 22, 2004 at 01:44:44PM -0700, Sara Collins wrote:
This might be very easy for a lot of you but I've been banging my head on the wall.
I just installed the boost library and tried to run a simple test file using boost.thread.mutex
#include
int main() { boost::mutex m; }
I got this compilation error message: undefined reference to `boost::mutex::mutex[in-charge]()'
I guess I have to link in the libboost_thread.dll file
Yes, you do, otherwise the linker can't find the definition of your class that has already been compiled and lives elsewhere. It's fairly simple on a Unix-like system. If you're on that system that uses the .dll naming convention, then I can't help you much. Now to build your program, you need to know the where your library is, and what it is named. On my machine it is in ~/local/lib and is called libboost_thread-gcc-mt.so, so for me to compile your program I would do: $ g++ -L~/local/lib -lboost_thread-gcc-mt program.cpp -o program Notice that when using the `-l' flag, you drop the `lib' prefix and `.so' suffix.
somehow but I don't seem to find a solution how. Perharps I've been searching the wrong places.
This HOWTO has been useful to me. http://www.tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html
Please help the newbie. Thanks a lot in advance.
No problem. Justin
participants (3)
-
Justin Findlay
-
Rene Rivera
-
Sara Collins