【发布时间】:2016-09-14 18:16:57
【问题描述】:
我收到了这个错误
CMake Error at /usr/local/share/cmake-3.5/Modules/FindBoost.cmake:1657 (message):
Unable to find the requested Boost libraries.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing
Boost's headers.
在我的 CMake 中
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
message("\n\n Boost found \n\n")
endif()
...然后
target_link_libraries(${files}
${catkin_LIBRARIES}
${MY_LIB}
${MY_LIB}
${gsl_LIBRARIES}
# ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_REGEX_LIBRARY}
${Boost_LIBRARIES} #new for catkin ...)
我什至尝试过find_package( Boost REQUIRED COMPONENTS components)、find_package( Boost REQUIRED)、find_package(Bost 1.60.0 COMPONENTS filesystem regex) 或find_package(Boost REQUIRED COMPONENTS system) ...但没有成功
关于我安装了 boost 之类的信息
$ cd ~/soft/lib/boost/boost_1_60_0
$ /bootstrap.sh
$ ./b2
..最后系统提示
The Boost C++ Libraries were successfully built!
The following directory should be added to compiler include paths:
/home/~/soft/lib/boost/boost_1_60_0
The following directory should be added to linker library paths:
/home/~/soft/lib/boost/boost_1_60_0/stage/lib
我刚刚将这两行添加到我的 .bashrc 中并获取了它。
export INCLUDE="/home/~/soft/lib/boost/boost_1_60_0:$INCLUDE"
export LIBRARY_PATH="/home/~/soft/lib/boost/boost_1_60_0/stage/lib:$LIBRARY_PATH"
对于信息,我也尝试了sudo apt-get install libbost-all-dev,但仍然没有。请问有什么办法吗?
【问题讨论】:
-
如何设置
BOOST_ROOT变量,作为错误消息建议? -
没明白重点。你能澄清一下吗?
-
将
BOOST_ROOT变量设置为Boost安装的根目录。在您的情况下,它应该类似于export BOOST_ROOT=/home/~/soft/lib/boost/boost_1_60_0。 -
更好(达到 100% )但最后还是有问题;很多
undefined reference to boost::xy.例如。undefined reference to boost::this_thread::interruption_point()我现在正在尝试添加 export BOOST_LIBS=... -
但如果我尝试
find_package( Boost REQUIRED COMPONENTS components )仍然有问题。它说Boost include path: /home/~/soft/lib/boost/boost_1_60_0 Could not find the following Boost libraries: boost_components
标签: c++ ubuntu boost compiler-errors cmake