【问题标题】:Boost installation on windows, libraries missing在 Windows 上加速安装,缺少库
【发布时间】:2014-04-24 07:48:02
【问题描述】:
我正在尝试构建提升。我关注了instructions here。我创建了一个文件夹 C:\Boost ,其中包含包含和库,并将其添加到我的环境路径中。但是,当我尝试使用 cMake 构建另一个项目时,我得到:
CMake Error at C:/Program Files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1106 (message):
Unable to find the requested Boost libraries.
Boost version: 1.55.0
Boost include path: C:/Boost/include/boost-1_55
The following Boost libraries could not be found:
boost_system
boost_filesystem
boost_signals
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
CMakeLists.txt:88 (find_package)
对那些丢失的库有任何想法吗?
【问题讨论】:
标签:
boost
installation
cmake
【解决方案1】:
从一个问题开始回答是一件坏事,但我还是这样做了:
- 首先,我是否正确地假设您设置了指向 C:\Boost 的环境变量 BOOST_ROOT? (此处仅将其添加到路径中可能还不够。)
- 其次,您运行的是哪个 CMake 生成器? Visual Studio、Makefile、忍者?
我最近遇到了一个与我实际使用的发电机有关的类似问题。更准确地说,我试图从 cmake-gui 中创建一个 Ninja 项目并得到几乎相同的错误消息。但是,我能够毫无问题地在 cmake-gui 项目中创建 Visual Studio 项目。
当仔细查看 Ninja 案例的命令输出时,我发现一开始有以下两行:
The C compiler identification is unknown
The CXX compiler identification is unknown
这暗示了实际问题。虽然很清楚 Visual Studio 将使用哪个编译器(9、10、11,...),但 cmake 无法推断 Ninja 的默认编译器,因为它是与不同编译器一起运行的通用构建系统。最终boost没有找到,因为编译器未知。
一个简单的解决方案是为您要运行的 Visual Studio 版本打开开发人员命令提示符。当您在此“扩展”命令提示符下创建项目时,CMake 将能够推断出正确的编译器。或者,您可以在运行 cmake 时设置 CMAKE_CXX_COMPILER 和 CMAKE_C_COMPILER 标志。
cmake -G "Ninja" <path/to/CMakeLists.txt>
cmake -G "Ninja" <path/to/CMakeLists.txt> -DCMAKE_CXX_COMPILER="path/to/cxx/compiler" -CMAKE_C_COMPILER="path/to/c/compiler"