Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/127.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Cmake找不到boost 1.51(windows 8)_C++_Windows_Boost_Cmake - Fatal编程技术网

C++ Cmake找不到boost 1.51(windows 8)

C++ Cmake找不到boost 1.51(windows 8),c++,windows,boost,cmake,C++,Windows,Boost,Cmake,我正在尝试编译需要boost的mlpack()。 首先我安装了boostpro 1.51(),现在boost安装在C:\Program Files\boost\boost\u 1\u 51中 然后,我使用cmake和mingw32 make编译并安装armadillo(mlpack的另一个依赖项)。Boost也是犰狳的附属品。根据一些建议(),我将其添加到CmakeList文件中: SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:\\Program

我正在尝试编译需要boost的mlpack()。 首先我安装了boostpro 1.51(),现在boost安装在C:\Program Files\boost\boost\u 1\u 51中

然后,我使用cmake和mingw32 make编译并安装armadillo(mlpack的另一个依赖项)。Boost也是犰狳的附属品。根据一些建议(),我将其添加到CmakeList文件中:

SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:\\Program Files\\boost\\boost_1_51")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "C:\\Program Files\\boost\\boost_1_51\\lib")
#Unfortunately this configuration variable is necessary and will need to be
#updated as time goes on and new versions are released.
set(Boost_ADDITIONAL_VERSIONS "1.41" "1.41.0" "1.42" "1.42.0" "1.43" "1.43.0" "1.44" "1.44.0" "1.45.0" "1.46.0" "1.46.1" "1.47.0" "1.48.0" "1.49.0" "1.51.0")
find_package(Boost
    COMPONENTS
      program_options
      unit_test_framework
    REQUIRED
)
include_directories(${Boost_INCLUDE_DIRS})
事情进展顺利

现在我尝试在mlpack上运行CMake,但出现以下错误:

C:/Program Files(x86)/CMake 2.8/share/CMake-2.8/Modules/FindBoos处的CMake错误 t、 cmake:1192(信息): 找不到请求的Boost库

Boost版本:1.51.0

Boost包含路径:C:/Program Files/Boost/Boost\u 1\u 51

找不到以下Boost库:

     boost_program_options
     boost_unit_test_framework
未找到任何Boost库。您可能需要将BOOST_LIBRARYDIR设置为 包含Boost库或Boost_根目录的目录 促进 调用堆栈(最新调用优先): CMakeLists.txt:192(查找包)

我试图添加(关于犰狳),但没有改进:

SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:\\Program Files\\boost\\boost_1_51")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "C:\\Program Files\\boost\\boost_1_51\\lib")
然后我也试着补充:

set(BOOST_ROOT "C:\\Program Files\\boost\\boost_1_51")
set(BOOST_INCLUDEDIR "C:\\Program Files\\boost\\boost_1_51")
set(BOOST_LIBRARYDIR "C:\\Program Files\\boost\\boost_1_51\\lib")
对于BOOST_INCLUDEDIR,我真的不知道应该指向哪个文件夹。boost_1_51包含:bin、boost、dist、doc、lib、libs等

我也尝试过这个(),但没有成功

我也有点困惑,因为犰狳似乎没有问题(或者我错过了什么?)

非常感谢

注意:cmakelists文件的内容:

SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "C:\\Program Files\\boost\\boost_1_51")
SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "C:\\Program Files\\boost\\boost_1_51\\lib")
#Unfortunately this configuration variable is necessary and will need to be
#updated as time goes on and new versions are released.
set(Boost_ADDITIONAL_VERSIONS "1.41" "1.41.0" "1.42" "1.42.0" "1.43" "1.43.0" "1.44" "1.44.0" "1.45.0" "1.46.0" "1.46.1" "1.47.0" "1.48.0" "1.49.0" "1.51.0")
find_package(Boost
    COMPONENTS
      program_options
      unit_test_framework
    REQUIRED
)
include_directories(${Boost_INCLUDE_DIRS})
我自己加了1.51.0


根据我在另一篇文章()中的理解,这可能与找不到名称正确的库有关。在我的lib文件夹中,我有(dll和lib文件):

不知怎的,我应该玩像这样的命令

set(Boost_USE_MULTITHREADED ON)

因此它将查找具有预期名称的库

您可以在-DBoost_DEBUG=ON的情况下重新运行cmake并发布输出吗?另外,您是否使用指定为
“MinGW makefile”
的生成器调用cmake?你列出的Boost LIBS是用Visual C++使用的(请注意代码< VC>代码),我很确定上面的注释是问题所在。boost的两个版本分别适用于VC 2005和VC 2010。这两种方法都不适用于mingw。Boost需要与mingw一起构建才能正常工作。谢谢。最后我重新编译了boost,这个问题消失了。现在我在使用make编译时遇到了问题,“boost::program_options:::…”的未定义引用。关于VC的Boost版本,我是C++新手,困惑:我认为编译库是专门针对OS/CPU的。库也可以特定于IDE?