我在linux下UBUNTU下工作在eclipse 10.10,使用Synaptic pkg管理器安装boost-dev软件包1.40。我是Linux新手,这个提升pkg。我尝试创建一个新的项目,并写上:不能编译,如果包括提升/线程在Linux Ubuntu 10.10
#include <boost/thread.hpp>
int main(int argc, char* argv[]){
}
我不包括任何东西,或任何地方写这样并行线程东西。 试图建立的时候,它说:
/usr/include/boost/config/requires_threads.hpp:47: error: #error "Compiler threading support is not turned on. Please set the correct command line options for threading: -pthread (Linux), -pthreads (Solaris) or -mthreads (Mingw32)"
In file included from /usr/include/boost/thread/thread.hpp:12,
from /usr/include/boost/thread.hpp:13,
from ../main.cpp:8:
/usr/include/boost/thread/detail/platform.hpp:67: error: #error "Sorry, no boost threads are available for this platform."
In file included from /usr/include/boost/thread.hpp:13,
from ../main.cpp:8:
/usr/include/boost/thread/thread.hpp:19: error: #error "Boost threads unavailable on this platform"
等等,很多相关的多个错误的提振。 我试图将-pthread
,-pthreads
,-lpthread
添加到我认为可以的地方,但没有解决问题。 我忘了提及,我试图在eclipse中构建项目,我不在命令行工作,但我也尝试了g ++ -pthread main.cpp,它给出了完全相同的错误。 请详细说明或stepbystep解决方案,因为您在这里回答的一些问题对我来说只是中文。我只想让一件简单的事情运行,甚至不理解问题。甚至不明白那个错误信息,它要我做什么。 基本上我做了:安装eclipse,将上述内容写入新项目,使用sinaptic pkg管理器安装libboost 1.4,并重新启动所有内容并尝试编译。我得到了错误。看不到发生了什么,或者我错过了什么。 (我有libc-dev) 堆栈现在真的流淌了。需要一些睡眠来降温。谢谢你们的帮助!
哇,那是我第一次听说过Linux的称为Linux 10.10。毫无疑问,Ubuntu肯定会产生一些影响。 :-) – Shinnok 2011-03-22 10:58:43
对不起,我是新来的所有这些Linux和Ubuntu的东西,但是,是的,这是一个错误:)有趣,虽然 – andrissh 2011-03-22 11:15:03
显示您的编译命令行完全在你的问题。 Boost线程只是包装底层的OS线程,所以通过包含boost/thread.hpp来请求pthreads。 – Duck 2011-03-22 13:14:31