【发布时间】:2012-03-23 06:40:57
【问题描述】:
我正在尝试使用 boost 库学习一些东西,但是当我尝试编译包含 boost::threads 的东西时遇到了问题。 我在链接过程中遇到错误,这是消息:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lboost-thread
但这很奇怪,因为只有当我使用普通用户编译时才会发生这种情况,使用 root 我可以毫无问题地编译。
提前致谢。
【问题讨论】:
-
你运行的命令是什么?通常你必须在其中的某个地方提供
-L[/path/to/boost],以便它知道在哪里可以找到它。 -
最新版本的 boost 需要使用“-lboost_thread”
-
这是我运行的命令:g++ -L/usr/local/boost_1_48_0/stage/lib -lboost-thread threadBoost.cpp,但它只能从 root 工作
标签: c++ boost linker boost-thread