我正在使用 Visual Studio 2022 版本 17.10.3 并通过 vcpkg 在清单模式下管理 Boost 依赖项。但是,当我构建一个简单的项目时,我遇到了与构建 boost-thread 库特别相关的错误,问题是什么?.
1>CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
1> Command failed: C:/VCPKG/vcpkg/downloads/tools/cmake-3.29.2-windows/cmake-3.29.2-windows-i386/bin/cmake.exe --build . --config Debug --target install -- -v -j7
1> Working Directory: C:/VCPKG/vcpkg/buildtrees/boost-thread/x64-windows-dbg
1> See logs for more information:
1> C:\VCPKG\vcpkg\buildtrees\boost-thread\install-x64-windows-dbg-out.log
1>
1>Call Stack (most recent call first):
1> C:/Users/parsiss_admin/source/repos/ConsoleApplication1/vcpkg_installed/x64-windows/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
1> C:/Users/parsiss_admin/source/repos/ConsoleApplication1/vcpkg_installed/x64-windows/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
1> C:/Users/parsiss_admin/source/repos/ConsoleApplication1/vcpkg_installed/x64-windows/x64-windows/share/boost-build/boost-modular-build.cmake:139 (vcpkg_cmake_install)
1> C:/Users/parsiss_admin/AppData/Local/vcpkg/registries/git-trees/f2f50fecd4338161565a0425c3e9b55fdbe68424/portfile.cmake:12 (boost_modular_build)
1> scripts/ports.cmake:192 (include)
1>
1>
1>EXEC : error : building boost-thread:x64-windows failed with: BUILD_FAILED
1>Elapsed time to handle boost-thread:x64-windows: 9.7 s
1>Please ensure you're using the latest po
这来自构建 boost-thread 日志:错误:
'/boost//C:/Users/parsiss_admin/source/repos/ConsoleApplication1/vcpkg_installed/x64-windows/x64-windows/debug/lib/boost_chrono-vc140-mt-gd.lib'
debug/lib/ 中的所有库都是 vc144 库
此问题的解决方案可以在https://github.com/microsoft/vcpkg/issues/38980
找到您遇到此问题的原因是因为您将 boost ports 的版本与 boost ports 不知道/测试过的 msvc 版本混合在一起。您只需更新到较新的 boost 版本/基线或遵循上述问题中提到的其他修复即可。