|
Boost Users : |
Subject: [Boost-users] [boost::thread] can not link on open suse
From: Kaz (sfx810_at_[hidden])
Date: 2011-12-11 12:50:34
Hi All,
I have downloaded 1.4.8 on a new machine running suse 12.1 Kde, and
built it using bjam install option.
Now I have a very simple threading program as follows
#include <boost/thread.hpp>
#include <iostream>
void func()
{
for(int i = 0; i < 10; ++i )
std::cout<<i<<std::endl;
}
int main ()
{
boost::thread th0(func);
th0.join();
return 0;
}
when I try to compile it using this command
g++ -static -I./Built_Boost_1.4.8.0/include
-L./Built_Boost_1.4.8.0/lib/ boostThreadTest.cpp -lboost_thread
-lpthread -o threadTest
I get following error
/usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld:
cannot find -lpthread
/usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld:
cannot find -lm
/usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld:
cannot find -lc
collect2: ld returned 1 exit status
I have searched for libpthread.a, but can not find it in my system.
although I can see these
/lib/libpthread.so
/usr/include/pthread.h
also if I remove -lpthread from build command, I still get the last
two errors i-e
/usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld:
cannot find -lm
/usr/lib/gcc/i586-suse-linux/4.6/../../../../i586-suse-linux/bin/ld:
cannot find -lc
collect2: ld returned 1 exit status
So question is, do I need libpthread ? ( from my past experience I
think I do, but not sure).
if yes, then how can I get it, and if not, then how can I get this
program to compile.
Any help will be appreciated.
Kaz
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