Visual Studio 2017兼容性与Boost 1.64.0/1.63.0问题 [英] Visual Studio 2017 compatibality with boost 1.64.0/1.63.0 issue

查看:101
本文介绍了Visual Studio 2017兼容性与Boost 1.64.0/1.63.0问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Boost 1.64.0的项目,因为我需要Boost过程.处理了它的CMakeList并使用Qt/Clion编译了代码,但是当我在Visual Studio 2017中使用相同的代码时,出现以下错误(bellow是boost 1.63.0的输出,但我是第一次尝试1.64.0).

I have a project which uses boost 1.64.0 since I need boost process. Its CMakeList processed and the code compiled using Qt/Clion but when I use the same code with Visual Studio 2017 I got following error (bellow is output of boost 1.63.0 but I tried 1.64.0 at first time).

1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:987 ] _boost_TEST_VERSIONS = 
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:989 ] Boost_USE_MULTITHREADED = ON
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:991 ] Boost_USE_STATIC_LIBS = ON
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:993 ] Boost_USE_STATIC_RUNTIME = 
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:995 ] Boost_ADDITIONAL_VERSIONS = 
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:997 ] Boost_NO_SYSTEM_PATHS = 
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1065 ] Declared as CMake or Environmental Variables:
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1067 ]   BOOST_ROOT = 
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1069 ]   BOOST_INCLUDEDIR = 
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1071 ]   BOOST_LIBRARYDIR = 
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1073 ] _boost_TEST_VERSIONS = 
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1166 ] location of version.hpp: D:/Program Files/boost_1_63_0/boost/version.hpp
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1190 ] version.hpp reveals boost 1.63.0
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1276 ] guessed _boost_COMPILER = -vc150
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1286 ] _boost_MULTITHREADED = -mt
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1330 ] _boost_RELEASE_ABI_TAG = -
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1332 ] _boost_DEBUG_ABI_TAG = -gd
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1388 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = D:/Program Files/boost_1_63_0/bin/x64;D:/Program Files/boost_1_63_0/lib;D:/Program Files/boost_1_63_0/stage/lib;D:/Program Files/boost_1_63_0/lib64-msvc-15.0;D:/Program Files/boost_1_63_0/lib;D:/Program Files/boost_1_63_0/../lib;D:/Program Files/boost_1_63_0/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib_boost_LIBRARY_SEARCH_DIRS_DEBUG   = D:/Program Files/boost_1_63_0/bin/x64;D:/Program Files/boost_1_63_0/lib;D:/Program Files/boost_1_63_0/stage/lib;D:/Program Files/boost_1_63_0/lib64-msvc-15.0;D:/Program Files/boost_1_63_0/lib;D:/Program Files/boost_1_63_0/../lib;D:/Program Files/boost_1_63_0/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
1> CMake Warning at C:/.../cmake-3.7/Modules/FindBoost.cmake:746 (message):
1>   Imported targets not available for Boost version 106300
1> Call Stack (most recent call first):
1>   C:/.../cmake-3.7/Modules/FindBoost.cmake:850 (_Boost_COMPONENT_DEPENDENCIES)
1>   C:/.../cmake-3.7/Modules/FindBoost.cmake:1439 (_Boost_MISSING_DEPENDENCIES)
1>   projects/Visualizer/CMakeLists.txt:121 (find_package)
1> 
1> 
1> CMake Warning at C:/.../cmake-3.7/Modules/FindBoost.cmake:746 (message):
1>   Imported targets not available for Boost version 106300
1> Call Stack (most recent call first):
1>   C:/.../cmake-3.7/Modules/FindBoost.cmake:850 (_Boost_COMPONENT_DEPENDENCIES)
1>   C:/.../cmake-3.7/Modules/FindBoost.cmake:1439 (_Boost_MISSING_DEPENDENCIES)
1>   projects/Visualizer/CMakeLists.txt:121 (find_package)
1> 
1> 
1> CMake Warning at C:/.../cmake-3.7/Modules/FindBoost.cmake:746 (message):
1>   Imported targets not available for Boost version 106300
1> Call Stack (most recent call first):
1>   C:/.../cmake-3.7/Modules/FindBoost.cmake:850 (_Boost_COMPONENT_DEPENDENCIES)
1>   C:/.../cmake-3.7/Modules/FindBoost.cmake:1439 (_Boost_MISSING_DEPENDENCIES)
1>   projects/Visualizer/CMakeLists.txt:121 (find_package)
1> 
1> 
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1527 ] Searching for SYSTEM_LIBRARY_RELEASE: libboost_system-vc150-mt-1_63;libboost_system-vc150-mt;libboost_system-mt-1_63;libboost_system-mt;libboost_system;libboost_system-vc150-mt-s-1_63;libboost_system-vc150-mt-s;libboost_system-mt-s-1_63;libboost_system-mt-s
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1569 ] Searching for SYSTEM_LIBRARY_DEBUG: libboost_system-vc150-mt-gd-1_63;libboost_system-vc150-mt-gd;libboost_system-mt-gd-1_63;libboost_system-mt-gd;libboost_system-mt;libboost_system;libboost_system-vc150-mt-s-gd-1_63;libboost_system-vc150-mt-s-gd;libboost_system-mt-s-gd-1_63;libboost_system-mt-s-gd
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1527 ] Searching for FILESYSTEM_LIBRARY_RELEASE: libboost_filesystem-vc150-mt-1_63;libboost_filesystem-vc150-mt;libboost_filesystem-mt-1_63;libboost_filesystem-mt;libboost_filesystem;libboost_filesystem-vc150-mt-s-1_63;libboost_filesystem-vc150-mt-s;libboost_filesystem-mt-s-1_63;libboost_filesystem-mt-s
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1569 ] Searching for FILESYSTEM_LIBRARY_DEBUG: libboost_filesystem-vc150-mt-gd-1_63;libboost_filesystem-vc150-mt-gd;libboost_filesystem-mt-gd-1_63;libboost_filesystem-mt-gd;libboost_filesystem-mt;libboost_filesystem;libboost_filesystem-vc150-mt-s-gd-1_63;libboost_filesystem-vc150-mt-s-gd;libboost_filesystem-mt-s-gd-1_63;libboost_filesystem-mt-s-gd
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1527 ] Searching for THREAD_LIBRARY_RELEASE: libboost_thread-vc150-mt-1_63;libboost_thread-vc150-mt;libboost_thread-mt-1_63;libboost_thread-mt;libboost_thread;libboost_thread-vc150-mt-s-1_63;libboost_thread-vc150-mt-s;libboost_thread-mt-s-1_63;libboost_thread-mt-s
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1569 ] Searching for THREAD_LIBRARY_DEBUG: libboost_thread-vc150-mt-gd-1_63;libboost_thread-vc150-mt-gd;libboost_thread-mt-gd-1_63;libboost_thread-mt-gd;libboost_thread-mt;libboost_thread;libboost_thread-vc150-mt-s-gd-1_63;libboost_thread-vc150-mt-s-gd;libboost_thread-mt-s-gd-1_63;libboost_thread-mt-s-gd
1> -- [ C:/.../cmake-3.7/Modules/FindBoost.cmake:1639 ] Boost_FOUND = 1
1> CMake Error at C:/.../cmake-3.7/Modules/FindBoost.cmake:1795 (message):
1>   Unable to find the requested Boost libraries.
1> 
1>   Boost version: 1.63.0
1> 
1>   Boost include path: D:/Program Files/boost_1_63_0
1> 
1>   Could not find the following static Boost libraries:
1> 
1>           boost_system
1>           boost_filesystem
1>           boost_thread
1> 
1>   No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
1>   directory containing Boost libraries or BOOST_ROOT to the location of
1>   Boost.

根据建议此处我将boost降级到1.63.0,但是又遇到了同样的错误.

As suggested here I downgrade boost to 1.63.0 but it got same error again.

关于此问题是否有任何建议(我确定已正确设置BOOST_ROOTBOOST_INCLUDEDIRBOOST_LIBRARYDIR)?

Is there any suggestion about the problem(I am sure that I set the BOOST_ROOT, BOOST_INCLUDEDIR and BOOST_LIBRARYDIR appropriately)?

我可以升级VS2017-cmake以使用cmake 3.8(单独安装cmake 3.8并浏览VS2017以使用它)吗?

Can I upgrade VS2017-cmake to use cmake 3.8 (install cmake 3.8 separately and browse VS2017 to use it)?

VS2017(cmake 3.7)与哪个版本的boost兼容?

VS2017(cmake 3.7) is compatible with which version of boost?

推荐答案

我使用Visual Studio编译了一个使用Boost 1.64.0的基于Cmake的项目.问题是Visual Studio的CMake(v3.7)无法找到Boost库/dll.如图所示,Dan Masek CMake在构建令牌时添加了令牌-vc141来增强libs/dll,而FindBoost必须知道令牌(令牌为-vc140-vc141等)才能找到它们.

I used Visual studio to compile a Cmake-based project which uses boost 1.64.0. The problem was Visual studio's CMake(v3.7) which is unable to find the boost libs/dlls. As figure out Dan Masek CMake add a token -vc141 to boost libs/dlls when build it and FindBoost must know it(token is -vc140, -vc141 or etc) in order to find them.

在CMake(v3.7)中,此令牌是-v150用于增强,它是使用Visual Studio 2017构建的.使用-v141对其进行更改会使所有事情变为现实.

In the CMake(v3.7) this token is -v150 for boost which it build with Visual Studio 2017. Changing that with -v141 made every thing true.

摘要::要查找Visual Studio 2017 boost lib/dll,请执行以下操作:查找文件FindBoost.cmake,并在第431行将set(_boost_COMPILER "-vc150")更改为set(_boost_COMPILER "-vc141").

Summary: In order to find Visual Studio 2017 boost libs/dlls: Find file FindBoost.cmake and at line 431 change set(_boost_COMPILER "-vc150") to set(_boost_COMPILER "-vc141").

这篇关于Visual Studio 2017兼容性与Boost 1.64.0/1.63.0问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆