Visual Studio 2017兼容性提升1.64.0 / 1.63.0问题

时间:2017-09-04 13:41:58

标签: c++ boost cmake visual-studio-2017

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

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.

根据建议here我将升级降级为1.63.0,但它再次出现同样的错误。

是否有任何关于此问题的建议(我确信我已恰当地设置了BOOST_ROOTBOOST_INCLUDEDIRBOOST_LIBRARYDIR)?

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

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

1 个答案:

答案 0 :(得分:1)

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

在CMake(v3.7)中,此标记为-v150,用于使用Visual Studio 2017构建的提升。使用-v141进行更改使每个事情都成立。

摘要:为了找到Visual Studio 2017提升库/ dll:查找文件FindBoost.cmake并在431行{}将set(_boost_COMPILER "-vc150")更改为set(_boost_COMPILER "-vc141") }。