Shaolin wrote:
> I am try to create a thread with boost but eveytime I execute I get some
> freaky error messages. See code below followed by error msg:
>
> #include <boost/thread/thread.hpp>
> #include <iostream>
> using namespace std;
>
> void hello()
> {
> cout << "hello" << endl;
> }
>
> int main(int argc, char* argv[])
> {
> boost::thread thrd1(&hello); // ERROR caused by the &hello param
> thrd1.join();
>
> }
>
You need to link to the thread library.
Please read the getting started guide.
In Christ,
Steven Watanabe
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
I have read the getting started section and its confused me even more.
$ c++ -I path/to/boost_1_39_0 example.cpp -o example \
~/boost/stage/lib/libboost_regex-gcc34-mt-d-1_36.a
Ok, I have managed to compile and install the libs but I dont know how to include it in the commandline. The regex example works fine but how do I do it for thread ?$ c++ -I path/to/boost_1_39_0 example.cpp -o example \
~/boost/stage/lib/libboost_regex-gcc34-mt-d-1_36.a
Shaolin wrote:
> Thanks, it looks like I didnt install it properly .. below is the error
> message I get:
>
> *g++: ~/boost/stage/lib/libboost_thread-gcc34-mt-d-1_36.a: No such file or
> directory*
>
> This is what I did the install the lib.
> $ cd /usr/local/boost_1_39_0
> $ sudo ./bootstrap.sh
> $ sudo ./bjam install
>
bjam install places the libraries under /usr/lib
bjam stage or just bjam puts the libraries
in stage/lib.
In Christ,
Steven Watanabe
Shaolin wrote:
> Ok, I have reconfigured it and the file is now located in the boost_1_39_0
> directory. However, it still doesnt work. This is what I type in command
> line:
>
> g++ -I /usr/local/boost_1_39_0 test.cc -o example \
> ~/stage/lib/libboost_thread-gcc43-mt-1_39.a
>
Does ~/stage/lib/libboost_thread-gcc43-mt-1_39.a exist?
From what you say below I doubt it, so of course it doesn't
work.
> *stage directory*:
> /usr/local/boost_1_39_0/stage/lib/libboost_thread-gcc43-mt-1_39.a
>
Assuming that this is the actual location of the library, use
-L/usr/local/boost_1_39_0/stage/lib -lboost_thread-gcc43-mt-1_39
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