boost thread 使用, 编译失败, 求助

bingqingwu5799 2014-12-18 08:49:25
boost 版本: boost_1_57_0
gcc 版本: 4.7.4

程序中包含头文件: #include <boost/thread/thread.hpp>
编译失败,错误信息如下:

In file included from /usr/include/boost/smart_ptr/enable_shared_from_this.hpp:16:0,
from /usr/include/boost/enable_shared_from_this.hpp:16,
from /usr/include/boost/thread/pthread/thread_data.hpp:17,
from /usr/include/boost/thread/thread_only.hpp:17,
from /usr/include/boost/thread/thread.hpp:12,
from ../src/main.cpp:33:
/usr/include/boost/smart_ptr/weak_ptr.hpp:32:37: error: ‘sp_element’ in namespace ‘boost::detail’ does not name a type
/usr/include/boost/smart_ptr/weak_ptr.hpp:32:47: error: expected unqualified-id before ‘<’ token
...全文
402 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
fly_dragon_fly 2014-12-18
  • 打赏
  • 举报
回复
在 boost/smart_ptr/shared_ptr.hpp里面有这个定义的,你看看有没有,
bingqingwu5799 2014-12-18
  • 打赏
  • 举报
回复
我之前通过yum安装过boost; 现在手动编译1.57版本,安装的时候include文件就没有被拷贝到/usr/include/目录下。/usr/include/目录下的boost文件还是通过yum安装时的文件。我把它手动移走,重新安装就好了。多谢fly_dragon_fly的提醒, 分就给你了把
shada 2014-12-18
  • 打赏
  • 举报
回复
我也用57没问题啊,如果可能,把代码片断发出来。
bingqingwu5799 2014-12-18
  • 打赏
  • 举报
回复
在 boost/smart_ptr/shared_ptr.hpp里没找到,应该是重新编译新版本boost的时候有问题,没注意,系统里面应该是旧版本的。再看看。。。

64,637

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧