[boost-users] Compile and Install boost::thread from souce code on Ubuntu

Hi, there,
The most updated version of boost on my Ubuntu is 1_40_0. So I choose
to compile and install 1_43_0 from source code. During the building process
of step 4 (mentioned bellow), I was prompted that boost::thread, boost::mpi,
etc. libraries need to be compiled and installed separetly. I ignored them
and finished the process.
Now I can run the following program sucessfully with
// robert@ubuntu:~/boost$ g++ -I /home/robert/src/boost_1_43_0 example.cpp
-o example
// echo 1 2 3 | ./example
for example.cpp
===================
#include <iostream>
#include <iterator>
#include <algorithm>
int main()
{
using namespace boost::lambda;
typedef std::istream_iterator<int> in;
std::for_each(
in(std::cin), in(), std::cout << (_1 * 3) << " " );
}
===================
but failed to compile thread.cpp program with
robert@ubuntu:~/boost$ g++ -I /home/robert/src/boost_1_43_0 thread.cpp -o
thread
for the following thread.cpp
===================
#include

AMDG Boost lzw wrote:
<snip> but failed to compile thread.cpp program with robert@ubuntu:~/boost$ g++ -I /home/robert/src/boost_1_43_0 thread.cpp -o thread
-L/usr/local/lib -lboost_thread
for the following thread.cpp =================== <snip> ===================
The first few complaints I got are: ---------------------------------------------- /tmp/ccwgSZ3d.o: In function `main': thread.cpp:(.text+0x6e): undefined reference to `boost::thread::join()' thread.cpp:(.text+0x7f): undefined reference to `boost::thread::~thread()' thread.cpp:(.text+0xa0): undefined reference to `boost::thread::~thread()' /tmp/ccwgSZ3d.o: In function `boost::detail::thread_data_base::thread_data_base()': How can I compile boost::thread separately for it to work? Thanks a lot.
It looks like you already did
(4) robert@ubuntu:~/src/boost_1_43_0$ sudo ./bootstrap.sh --prefix=/usr/local --show-libraries --with-libraries=all --exec-prefix=/usr/local/bin/
(5) ./bjam install
In Christ, Steven Watanabe

No. I tried again the following for the thread.cpp:
robert@ubuntu:~/boost$ g++ -L /home/robert/src/boost_1_43_0 -lboost_thread
thread.cpp -o thread
and got the following complaints:
thread.cpp:2:35: error: boost/thread/thread.hpp: No such file or directory
thread.cpp: In function ‘int main(int, char**)’:
thread.cpp:12: error: ‘boost’ has not been declared
thread.cpp:12: error: expected ‘;’ before ‘thrd’
thread.cpp:13: error: ‘thrd’ was not decon >
If I try
robert@ubuntu:~/boost$ g++ -L/usr/local -lboost_thread thread.cpp -o thread
I got:
thread.cpp:2:35: error: boost/thread/thread.hpp: No such file or directory
thread.cpp: In function ‘int main(int, char**)’:
thread.cpp:12: error: ‘boost’ has not been declared
thread.cpp:12: error: expected ‘;’ before ‘thrd’
thread.cpp:13: error: ‘thrd’ was not dec5
Currently there is nothing under directory /usr/local/lib that is related to
boost:
robert@ubuntu:/usr/local/lib$ ls -l
total 4
drwxrwsr-x 4 root staff 4096 2010-05-31 08:10 python2.6
but there is one lib directory as in:
/home/robert/src/boost_1_43_0 -lboost_thread/lib
I got nothing when checking out what boost packages I've already installed
with:
$ dpkg -l | grep boost
Any further hints? Thanks.
On Thu, Jun 17, 2010 at 9:36 AM, Steven Watanabe
AMDG
Boost lzw wrote:
<snip>
but failed to compile thread.cpp program with robert@ubuntu:~/boost$ g++ -I /home/robert/src/boost_1_43_0 thread.cpp -o thread
-L/usr/local/lib -lboost_thread
for the following thread.cpp
=================== <snip>
===================
The first few complaints I got are: ---------------------------------------------- /tmp/ccwgSZ3d.o: In function `main': thread.cpp:(.text+0x6e): undefined reference to `boost::thread::join()' thread.cpp:(.text+0x7f): undefined reference to `boost::thread::~thread()' thread.cpp:(.text+0xa0): undefined reference to `boost::thread::~thread()' /tmp/ccwgSZ3d.o: In function `boost::detail::thread_data_base::thread_data_base()': How can I compile boost::thread separately for it to work? Thanks a lot.
It looks like you already did
(4)
robert@ubuntu:~/src/boost_1_43_0$ sudo ./bootstrap.sh --prefix=/usr/local --show-libraries --with-libraries=all --exec-prefix=/usr/local/bin/
(5) ./bjam install
In Christ, Steven Watanabe
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
participants (2)
-
Boost lzw
-
Steven Watanabe