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
Kaz <sfx810@googlemail.com> writes:
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
Odd though it may seem, looks like you haven't installed libc6-dev. Hope this helps, -- Olaf Meeuwissen, LPIC-2 FLOSS Engineer -- AVASYS CORPORATION FSF Associate Member #1962 Help support software freedom http://www.fsf.org/jf?referrer=1962
participants (2)
-
Kaz
-
Olaf Meeuwissen