Boost logo

Boost Users :

From: Tuan A. Tran (tuantran167_at_[hidden])
Date: 2005-11-03 19:05:03


Hi Rene,

Thanks very much. It worked.

Tuan

On 11/3/05, Rene Rivera <grafik.list_at_[hidden]> wrote:
>
> Tuan A. Tran wrote:
>
> > I am a newbie. I would like to run a simple threaded program using
> boost. I
> > got a sample file see below and compile with the following command
> > g++ simple.cpp -lthread
> >
> > I got error
> > ////
> > In file included from /usr/include/boost/thread/detail/config.hpp:18,
> > from /usr/include/boost/thread/thread.hpp:15,
> > from /usr/include/boost/thread.hpp:15,
> > from simple.cpp:9:
> > /usr/include/boost/config/requires_threads.hpp:47:5: #error "Compiler
> > threading support is not turned on. Please set the correct command line
> > options for threading: -pthread (Linux), -pthreads (Solaris) or
> -mthreads
> > (Mingw32)"
> [...]
> > If I use commend g++ simple.cpp -pthread
> > I got error
> > ////////
> > /tmp/cchxK5CW.o(.text+0x66): In function `main':
> > : undefined reference to
> > `boost::thread::thread[in-charge](boost::function0<void,
> > std::allocator<boost::function_base> > const&)'
> > /tmp/cchxK5CW.o(.text+0x9d): In function `main':
> > : undefined reference to `boost::thread::join()'
> > /tmp/cchxK5CW.o(.text+0xa8): In function `main':
> > : undefined reference to `boost::thread::~thread [in-charge]()'
> > /tmp/cchxK5CW.o(.text+0xc2): In function `main':
> > : undefined reference to `boost::thread::~thread [in-charge]()'
> > collect2: ld returned 1 exit status
> > ///////////
> >
> > I do not know what went wrong. Can anyone tell me what I did wrong? How
> > should I correct so that I can compile this example?
>
> You also need to link to the compiled Boost.Thread library. Adding
> "-lboost_thread" might work.
>
>
> --
> -- Grafik - Don't Assume Anything
> -- Redshift Software, Inc. - http://redshift-software.com
> -- rrivera/acm.org - grafik/redshift-software.com <http://software.com>
> -- 102708583/icq - grafikrobot/aim - Grafik/jabber.org
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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