Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::disable_interruption problem
From: Mohammad Daei (modaei_at_[hidden])
Date: 2013-05-10 03:29:28


thanks for the help folks.
at first I tried "gcc example.cpp -o example -lboost_thread" which
resulted in the following error:
       /usr/bin/ld: cannot find -lboost_thread
       collect2: ld returned 1 exit status

 I tried this and finally it worked: "gcc example.cpp -o example -L
/root/boost_1_53_0/stage/lib/ -lboost_thread -lboost_system"

I added the "/root/boost_1_53_0/stage/lib/" to Eclipse "Library Paths" on
the project properties under the "C/C++ General" section and also added
"boost_thread", "boost_system" , "boost_regex" and "boost_date_time" to
"Libraries" on the same section. after building and compiling the undefined
reference error for "boost::this_thread::disable_interruption" was removed
but I received two new errors. one of them is:
                 /usr/include/boost/thread/detail/thread.hpp:191: undefined
reference to `boost::thread::start_thread()'

and the other is:

/root/workspace/AMI2/Debug/../src/manager/ManagerEventsHandler.cpp:46:
undefined reference to `boost::thread::~thread()'
in the following piece of code:
               #include <boost/thread.hpp>
               #include <boost/bind.hpp>
               #include <string.h>
                void ManagerEventsHandler::fireEvent(const ManagerEvent&
me) {
                       boost::thread
t(boost::bind(&ManagerEventsHandler::internalFireEvent, this, me));
                }

Given that I have included "boost/thread.hpp" in the source code and
included the boost::thread library path and binaries in the project, what
else should I do?

Mostafa I reviewed compiler options and I think I'm using them correctly.
are there any flaws?
Nat thanks for the link. it was very helpful.

On Fri, May 10, 2013 at 2:14 AM, Nat Linden <nat_at_[hidden]> wrote:

> On Thu, May 9, 2013 at 3:33 PM, Mostafa <mostafa_working_away_at_[hidden]>
> wrote:
>
> > On Thu, 09 May 2013 08:07:39 -0700, Mohammad Daei <modaei_at_[hidden]>
> wrote:
>
> >> I've tried
> >> "c++ -I /root/boost_1_53.0 example.cpp -o example",
> >> "c++ -I /root/boost_1_53.0 example.cpp -o example -lboost_system-mt
> >> -pthread",
> >> "c++ -I /root/boost_1_53.0 example.cpp -o example -L
> >> /root/boost_1_53.0/stage",
> >> I've tried installing boost through yum, or downloading source package
> and
> >> compiling them myself, still no luck
> >> I'm really running out of ideas here!
>
> > The best way to get meaningful help is to post the smallest complete
> source file that produces the error, and the accompanying full error
> message(s). Also read up on what the compiler command line options "-L" and
> "-l" mean, if you're not familiar with them.
>
> Also there's http://vladimir_prus.blogspot.com/2009/06/linking-101.html
> _______________________________________________
> 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