当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 16 篇帖子 ]  前往页数 1, 2  下一页
作者 内容
1 楼 
 文章标题 : 你们能编译通过吗?
帖子发表于 : 2012-01-12 20:12 

注册: 2011-12-06 20:11
帖子: 25
送出感谢: 0 次
接收感谢: 0 次
我在网上找的代码,就是编译通不过(用linux下g++ 编译)。帮我看一下,错在哪?
#include <boost/thread/thread.hpp>
#include <iostream>
using namespace std;
void hello()
{
std::cout <<
"Hello world, I'm a thread!"
<< std::endl;
}

int main(int argc, char* argv[])
{
boost::thread thrd(hello);
thrd.join();
return 0;
}

编译器显示的信息如下:
athread.cpp:(.text+0x5f): undefined reference to `boost::thread::join()'
athread.cpp:(.text+0x70): undefined reference to `boost::thread::~thread()'
athread.cpp:(.text+0x92): undefined reference to `boost::thread::~thread()'
/tmp/ccDeh5F3.o: In function `boost::detail::thread_data_base::thread_data_base()':
athread.cpp:(.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]+0x24): undefined reference to `vtable for boost::detail::thread_data_base'
/tmp/ccDeh5F3.o: In function `boost::thread::thread<void (*)()>(void (*)(), boost::disable_if<boost::is_convertible<void (*&)(), boost::detail::thread_move_t<void (*)()> >, boost::thread::dummy*>::type)':
athread.cpp:(.text._ZN5boost6threadC2IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE[_ZN5boost6threadC5IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE]+0x40): undefined reference to `boost::thread::start_thread()'
/tmp/ccDeh5F3.o: In function `boost::detail::thread_data<void (*)()>::~thread_data()':
athread.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED2Ev[_ZN5boost6detail11thread_dataIPFvvEED5Ev]+0x1f): undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/tmp/ccDeh5F3.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[typeinfo for boost::detail::thread_data<void (*)()>]+0x10): undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: ld 返回 1


页首
 用户资料  
 
2 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-12 20:18 
头像

注册: 2011-04-03 10:01
帖子: 981
地址: 帝都
系统: Ubuntu 12.XX
送出感谢: 28
接收感谢: 18
你确定安装了 libboost-thread 包(Ubuntu)?

去看这里
http://stackoverflow.com/questions/3584365/boost-thread-error-undefined-reference


_________________
Ubuntu技巧汇总http://wiki.ubuntu.org.cn/UbuntuSkills --你遇到的各种问题可能已经在里面了
我的技术博客http://www.cherrot.com
Code tells you how, comments should tell you why.


页首
 用户资料  
 
3 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-12 20:28 
头像

注册: 2008-07-24 11:33
帖子: 4793
地址: 郑州
送出感谢: 4
接收感谢: 92
没链接库吧。


_________________
求人不如求它仨: 天蓝的Wiki 屎黄的Wiki 绿
Site: CUIHAO.TK    Twitter: @cuihaoleo
Machine: Athlon64 X2 5200+ / 2x2GB DDR2-800 / GeForce GTS 450
AD: ~まだ見ぬ誰かの笑顔のために~


页首
 用户资料  
 
4 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-12 22:49 

注册: 2011-12-06 20:11
帖子: 25
送出感谢: 0 次
接收感谢: 0 次
cuihao 写道:
没链接库吧。



/usr/lib/libboost_thread.so已经装上了,如何用?


页首
 用户资料  
 
5 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-12 23:10 

注册: 2005-05-25 0:10
帖子: 66
送出感谢: 0 次
接收感谢: 1
-lboost_thread


页首
 用户资料  
 
6 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-13 10:40 

注册: 2011-12-06 20:11
帖子: 25
送出感谢: 0 次
接收感谢: 0 次
tsunli 写道:
-lboost_thread



wei@wei-Lenovo-G475:~/program$ g++ -lboost_thread athread.cpp
/tmp/ccT9235S.o: In function `main':
athread.cpp:(.text+0x50): undefined reference to `boost::thread::join()'
athread.cpp:(.text+0x61): undefined reference to `boost::thread::~thread()'
athread.cpp:(.text+0x79): undefined reference to `boost::thread::~thread()'
/tmp/ccT9235S.o: In function `boost::detail::thread_data_base::thread_data_base()':
athread.cpp:(.text._ZN5boost6detail16thread_data_baseC2Ev[_ZN5boost6detail16thread_data_baseC5Ev]+0x24): undefined reference to `vtable for boost::detail::thread_data_base'
/tmp/ccT9235S.o: In function `boost::thread::thread<void (*)()>(void (*)(), boost::disable_if<boost::is_convertible<void (*&)(), boost::detail::thread_move_t<void (*)()> >, boost::thread::dummy*>::type)':
athread.cpp:(.text._ZN5boost6threadC2IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE[_ZN5boost6threadC5IPFvvEEET_NS_10disable_ifINS_14is_convertibleIRS4_NS_6detail13thread_move_tIS4_EEEEPNS0_5dummyEE4typeE]+0x30): undefined reference to `boost::thread::start_thread()'
/tmp/ccT9235S.o: In function `boost::detail::thread_data<void (*)()>::~thread_data()':
athread.cpp:(.text._ZN5boost6detail11thread_dataIPFvvEED2Ev[_ZN5boost6detail11thread_dataIPFvvEED5Ev]+0x1f): undefined reference to `boost::detail::thread_data_base::~thread_data_base()'
/tmp/ccT9235S.o:(.rodata._ZTIN5boost6detail11thread_dataIPFvvEEE[typeinfo for boost::detail::thread_data<void (*)()>]+0x10): undefined reference to `typeinfo for boost::detail::thread_data_base'
collect2: ld 返回 1


也不行呀,试好了,再给我发吧。


页首
 用户资料  
 
7 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-13 12:30 
头像

注册: 2006-07-02 11:16
帖子: 12522
地址: 廣州
送出感谢: 0 次
接收感谢: 8
要装 boost 的 dev,那个 so 是没用的,要 .a 文件


_________________
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。


页首
 用户资料  
 
8 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-13 12:39 
头像

注册: 2011-04-03 10:01
帖子: 981
地址: 帝都
系统: Ubuntu 12.XX
送出感谢: 28
接收感谢: 18
.a .so 不是一样的么?
一个静态 一个动态

dev包提供头文件,倒是需要用到的。


_________________
Ubuntu技巧汇总http://wiki.ubuntu.org.cn/UbuntuSkills --你遇到的各种问题可能已经在里面了
我的技术博客http://www.cherrot.com
Code tells you how, comments should tell you why.


页首
 用户资料  
 
9 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-13 12:51 

注册: 2011-12-06 20:11
帖子: 25
送出感谢: 0 次
接收感谢: 0 次
BigSnake.NET 写道:
要装 boost 的 dev,那个 so 是没用的,要 .a 文件


wei@wei-Lenovo-G475:~$ sudo find /usr -name *boost*.a -type f
[sudo] password for wei:
/usr/lib/libboost_serialization.a
/usr/lib/libboost_thread.a
/usr/lib/libboost_date_time.a
/usr/lib/libboost_wserialization.a
wei@wei-Lenovo-G475:~/program$ g++ athread.cpp -o athread /usr/lib/libboost_thread.a
/usr/lib/libboost_thread.a(thread.o): In function `_ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_.constprop.97':
(.text+0xc8): undefined reference to `pthread_key_create'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::interruption_enabled()':
(.text+0x540): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::disable_interruption()':
(.text+0x570): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::disable_interruption()':
(.text+0x59f): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::~disable_interruption()':
(.text+0x5c0): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::~disable_interruption()':
(.text+0x5d5): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o):(.text+0x605): more undefined references to `pthread_getspecific' follow
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::start_thread()':
(.text+0x7a9): undefined reference to `pthread_create'
/usr/lib/libboost_thread.a(thread.o): In function `thread_proxy':
(.text+0x8c6): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(thread.o): In function `thread_proxy':
(.text+0x8eb): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::interruption_requested()':
(.text+0xa2a): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::detach()':
(.text+0xb9d): undefined reference to `pthread_detach'
/usr/lib/libboost_thread.a(thread.o): In function `boost::(anonymous namespace)::make_external_thread_data()':
(.text+0x124a): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::add_thread_exit_function(boost::detail::thread_exit_function_base*)':
(.text+0x147d): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::get_id()':
(.text+0x14f2): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::interruption_point()':
(.text+0x15e1): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::join()':
(.text+0x1731): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::join()':
(.text+0x17e5): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o):(.text+0x1907): more undefined references to `pthread_getspecific' follow
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::join()':
(.text+0x1bce): undefined reference to `pthread_join'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x2256): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x22f3): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x25a7): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x2636): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x2716): undefined reference to `pthread_join'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::erase_tss_node(void const*)':
(.text+0x2d55): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::add_new_tss_node(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*)':
(.text+0x2db0): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)':
(.text+0x3054): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)':
(.text+0x319a): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::sleep(boost::posix_time::ptime const&)':
(.text+0x3230): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o):(.text+0x33bd): more undefined references to `pthread_getspecific' follow
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::(anonymous namespace)::create_current_thread_tls_key()':
(.text+0x1b): undefined reference to `pthread_key_create'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::get_current_thread_data()':
(.text+0x2f4): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::set_current_thread_data(boost::detail::thread_data_base*)':
(.text+0x314): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0x2c): undefined reference to `pthread_once'
/usr/lib/libboost_thread.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0x37): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0x67): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(once.o): In function `create_epoch_tss_key':
(.text+0xb): undefined reference to `pthread_key_create'
collect2: ld 返回 1
wei@wei-Lenovo-G475:~/program$
为什么还是不行?


页首
 用户资料  
 
10 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-13 13:01 
头像

注册: 2006-07-02 11:16
帖子: 12522
地址: 廣州
送出感谢: 0 次
接收感谢: 8
iamcaptainchen 写道:
BigSnake.NET 写道:
要装 boost 的 dev,那个 so 是没用的,要 .a 文件


wei@wei-Lenovo-G475:~$ sudo find /usr -name *boost*.a -type f
[sudo] password for wei:
/usr/lib/libboost_serialization.a
/usr/lib/libboost_thread.a
/usr/lib/libboost_date_time.a
/usr/lib/libboost_wserialization.a
wei@wei-Lenovo-G475:~/program$ g++ athread.cpp -o athread /usr/lib/libboost_thread.a
/usr/lib/libboost_thread.a(thread.o): In function `_ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_.constprop.97':
(.text+0xc8): undefined reference to `pthread_key_create'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::interruption_enabled()':
(.text+0x540): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::disable_interruption()':
(.text+0x570): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::disable_interruption()':
(.text+0x59f): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::~disable_interruption()':
(.text+0x5c0): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::~disable_interruption()':
(.text+0x5d5): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o):(.text+0x605): more undefined references to `pthread_getspecific' follow
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::start_thread()':
(.text+0x7a9): undefined reference to `pthread_create'
/usr/lib/libboost_thread.a(thread.o): In function `thread_proxy':
(.text+0x8c6): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(thread.o): In function `thread_proxy':
(.text+0x8eb): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::interruption_requested()':
(.text+0xa2a): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::detach()':
(.text+0xb9d): undefined reference to `pthread_detach'
/usr/lib/libboost_thread.a(thread.o): In function `boost::(anonymous namespace)::make_external_thread_data()':
(.text+0x124a): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::add_thread_exit_function(boost::detail::thread_exit_function_base*)':
(.text+0x147d): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::get_id()':
(.text+0x14f2): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::interruption_point()':
(.text+0x15e1): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::join()':
(.text+0x1731): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::join()':
(.text+0x17e5): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o):(.text+0x1907): more undefined references to `pthread_getspecific' follow
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::join()':
(.text+0x1bce): undefined reference to `pthread_join'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x2256): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x22f3): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x25a7): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x2636): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x2716): undefined reference to `pthread_join'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::erase_tss_node(void const*)':
(.text+0x2d55): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::add_new_tss_node(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*)':
(.text+0x2db0): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)':
(.text+0x3054): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)':
(.text+0x319a): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::sleep(boost::posix_time::ptime const&)':
(.text+0x3230): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o):(.text+0x33bd): more undefined references to `pthread_getspecific' follow
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::(anonymous namespace)::create_current_thread_tls_key()':
(.text+0x1b): undefined reference to `pthread_key_create'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::get_current_thread_data()':
(.text+0x2f4): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::set_current_thread_data(boost::detail::thread_data_base*)':
(.text+0x314): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0x2c): undefined reference to `pthread_once'
/usr/lib/libboost_thread.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0x37): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0x67): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(once.o): In function `create_epoch_tss_key':
(.text+0xb): undefined reference to `pthread_key_create'
collect2: ld 返回 1
wei@wei-Lenovo-G475:~/program$
为什么还是不行?


pthread 的 dev


_________________
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。


页首
 用户资料  
 
11 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-13 16:24 

注册: 2011-12-06 20:11
帖子: 25
送出感谢: 0 次
接收感谢: 0 次
BigSnake.NET 写道:
iamcaptainchen 写道:
BigSnake.NET 写道:
要装 boost 的 dev,那个 so 是没用的,要 .a 文件


wei@wei-Lenovo-G475:~$ sudo find /usr -name *boost*.a -type f
[sudo] password for wei:
/usr/lib/libboost_serialization.a
/usr/lib/libboost_thread.a
/usr/lib/libboost_date_time.a
/usr/lib/libboost_wserialization.a
wei@wei-Lenovo-G475:~/program$ g++ athread.cpp -o athread /usr/lib/libboost_thread.a
/usr/lib/libboost_thread.a(thread.o): In function `_ZN5boost9call_onceIPFvvEEEvRNS_9once_flagET_.constprop.97':
(.text+0xc8): undefined reference to `pthread_key_create'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::interruption_enabled()':
(.text+0x540): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::disable_interruption()':
(.text+0x570): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::disable_interruption()':
(.text+0x59f): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::~disable_interruption()':
(.text+0x5c0): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::disable_interruption::~disable_interruption()':
(.text+0x5d5): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o):(.text+0x605): more undefined references to `pthread_getspecific' follow
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::start_thread()':
(.text+0x7a9): undefined reference to `pthread_create'
/usr/lib/libboost_thread.a(thread.o): In function `thread_proxy':
(.text+0x8c6): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(thread.o): In function `thread_proxy':
(.text+0x8eb): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::interruption_requested()':
(.text+0xa2a): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::detach()':
(.text+0xb9d): undefined reference to `pthread_detach'
/usr/lib/libboost_thread.a(thread.o): In function `boost::(anonymous namespace)::make_external_thread_data()':
(.text+0x124a): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::add_thread_exit_function(boost::detail::thread_exit_function_base*)':
(.text+0x147d): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::get_id()':
(.text+0x14f2): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::interruption_point()':
(.text+0x15e1): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::join()':
(.text+0x1731): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::join()':
(.text+0x17e5): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o):(.text+0x1907): more undefined references to `pthread_getspecific' follow
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::join()':
(.text+0x1bce): undefined reference to `pthread_join'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x2256): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x22f3): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x25a7): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x2636): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::thread::timed_join(boost::posix_time::ptime const&)':
(.text+0x2716): undefined reference to `pthread_join'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::erase_tss_node(void const*)':
(.text+0x2d55): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::add_new_tss_node(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*)':
(.text+0x2db0): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)':
(.text+0x3054): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::set_tss_data(void const*, boost::shared_ptr<boost::detail::tss_cleanup_function>, void*, bool)':
(.text+0x319a): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::this_thread::sleep(boost::posix_time::ptime const&)':
(.text+0x3230): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o):(.text+0x33bd): more undefined references to `pthread_getspecific' follow
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::(anonymous namespace)::create_current_thread_tls_key()':
(.text+0x1b): undefined reference to `pthread_key_create'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::get_current_thread_data()':
(.text+0x2f4): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(thread.o): In function `boost::detail::set_current_thread_data(boost::detail::thread_data_base*)':
(.text+0x314): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0x2c): undefined reference to `pthread_once'
/usr/lib/libboost_thread.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0x37): undefined reference to `pthread_getspecific'
/usr/lib/libboost_thread.a(once.o): In function `boost::detail::get_once_per_thread_epoch()':
(.text+0x67): undefined reference to `pthread_setspecific'
/usr/lib/libboost_thread.a(once.o): In function `create_epoch_tss_key':
(.text+0xb): undefined reference to `pthread_key_create'
collect2: ld 返回 1
wei@wei-Lenovo-G475:~/program$
为什么还是不行?


pthread 的 dev




也不行,试好了,再发表意见!


页首
 用户资料  
 
12 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-13 18:24 
头像

注册: 2006-07-02 11:16
帖子: 12522
地址: 廣州
送出感谢: 0 次
接收感谢: 8
代码:
autumncat@ac-tp /tmp $ g++ a.cpp -o athread -lboost_thread
autumncat@ac-tp /tmp $ ./a.out
Hello world, I'm a thread!
autumncat@ac-tp /tmp $ g++ a.cpp -o athread /usr/lib/libboost_thread.so
autumncat@ac-tp /tmp $ ./a.out
Hello world, I'm a thread!


我只能说那四个字母


_________________
^_^ ~~~
要理解递归,首先要理解递归。

地球人都知道,理论上,理论跟实际是没有差别的,但实际上,理论跟实际的差别是相当大滴。


页首
 用户资料  
 
13 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-13 19:34 

注册: 2011-12-06 20:11
帖子: 25
送出感谢: 0 次
接收感谢: 0 次
BigSnake.NET 写道:
代码:
autumncat@ac-tp /tmp $ g++ a.cpp -o athread -lboost_thread
autumncat@ac-tp /tmp $ ./a.out
Hello world, I'm a thread!
autumncat@ac-tp /tmp $ g++ a.cpp -o athread /usr/lib/libboost_thread.so
autumncat@ac-tp /tmp $ ./a.out
Hello world, I'm a thread!


我只能说那四个字母


wei@wei-Lenovo-G475:~/program$ ls /usr/lib/libboost_thread*
/usr/lib/libboost_thread.a /usr/lib/libboost_thread-mt.so /usr/lib/libboost_thread.so.1.46.1
/usr/lib/libboost_thread-mt.a /usr/lib/libboost_thread.so

wei@wei-Lenovo-G475:~/program$ g++ athread.cpp /usr/lib/libboost_thread.so
/usr/bin/ld: 1: libboost-thread1.46.1:: not found
collect2: ld 返回 127
wei@wei-Lenovo-G475:~/program$ g++ athread.cpp -lboost_thread
/usr/bin/ld: 1: libboost-thread1.46.1:: not found
collect2: ld 返回 127
wei@wei-Lenovo-G475:~/program$

wrong!


页首
 用户资料  
 
14 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-13 22:30 
头像

注册: 2010-06-09 19:57
帖子: 1211
送出感谢: 2
接收感谢: 9
lz不会照葫芦画瓢看命令?
12不是有命令么


_________________
听歌


页首
 用户资料  
 
15 楼 
 文章标题 : Re: 你们能编译通过吗?
帖子发表于 : 2012-01-14 19:42 
头像

注册: 2009-07-25 1:57
帖子: 701
送出感谢: 5
接收感谢: 13
楼主链接boost的thread库,提示pthread的库都没有。然后开始喷那些教他链接boost的楼下。。。嗯,其实是自己准备功课都没做好。。。

ls -la /usr/lib/libboost_thread.so
加上这个看下,可能软链接指的东西都不对。


_________________
https://github.com/tangboyun
http://tangboyun.is-programmer.com/
提问的智慧————Eric Steven Raymond
回答的智慧————Andrew Clarke
吾尝终日而思矣,不如须臾之所学也;吾尝跂而望矣,不如登高之博见也。
急急急标题什么的,最讨厌了!
急急复急急,急急何其多,我生待急急,万事急急急。


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 16 篇帖子 ]  前往页数 1, 2  下一页

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 2 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译