gpt4 book ai didi

c++ - Visual Studio 2017 与 boost 1.64.0/1.63.0 的兼容性问题

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:08:22 26 4
gpt4 key购买 nike

我有一个使用 boost 1.64.0 的项目,因为我需要 boost 进程。它的 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我将 boost 降级到 1.63.0,但它再次出现同样的错误。

关于这个问题有什么建议吗(我确定我正确设置了BOOST_ROOTBOOST_INCLUDEDIRBOOST_LIBRARYDIR)?

能否升级VS2017-cmake使用cmake 3.8(单独安装cmake 3.8浏览VS2017即可使用)?

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

最佳答案

我使用 Visual Studio 编译了一个基于 Cmake 的项目,该项目使用了 boost 1.64.0。问题是 Visual Studio 的 CMake(v3.7) 无法找到 boost 库/dll。正如 Dan Masek CMake 在构建时添加一个标记 -vc141 来 boost libs/dll 并且 FindBoost 必须知道它(标记是 -vc140-vc141 或其他)以便找到它们。

在 CMake(v3.7) 中,此 token 是 -v150,用于使用 Visual Studio 2017 构建的 boost。使用 -v141 更改它使一切都成为现实。

总结:为了找到 Visual Studio 2017 boost libs/dll:找到文件 FindBoost.cmake 并在 431 行更改 set(_boost_COMPILER "-vc150")set(_boost_COMPILER "-vc141")

关于c++ - Visual Studio 2017 与 boost 1.64.0/1.63.0 的兼容性问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46038371/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com