gpt4 book ai didi

c++ - CMake 没有找到 boost

转载 作者:行者123 更新时间:2023-11-30 02:02:23 26 4
gpt4 key购买 nike

Windows 7。64 位。 CMake 2.8.10。

步骤:

cd C:\work\lib\boost_1_51_0-MTbootstrap.batbjam --toolset=msvc-10.0 --variant=release --build-type=complete -j 4 --with-regex --with-test --with-filesystem --with-date_time --with-random --with-system --with-thread --with-program_options --with-chrono --with-math stage link=static threading=multi runtime-link=static
  • 命令:
set BOOST_ROOT=C:\work\lib\boost_1_51_0-MTcmake M:\project  Unable to find the requested Boost libraries.  Boost version: 1.51.0  Boost include path: C:/work/lib/boost_1_51_0-MT  The following Boost libraries could not be found:          boost_system          boost_thread          boost_random          boost_chrono  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the  directory containing Boost libraries or BOOST_ROOT to the location of  Boost.

M:\project\CMakeLists.txt 包含:(我需要静态链接 boost)

...set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)set(USE_STATIC_BOOST ON)add_definitions(-DBOOST_THREAD_USE_LIB)add_definitions(-DBOOST_ALL_NO_LIB)find_package(Boost 1.48.0 COMPONENTS system thread random chrono REQUIRED)...

这个 CMakeLists.txt 是旧的,适用于其他 boost 安装(由我而不是我过去完成,但收据丢失)。

已解决

set(Boost_USE_STATIC_LIBS ON)

...现在 CMake 找到了 boost 库!虽然我的“set(USE_STATIC_BOOST ON)”肯定有同样的效果,但它没有...

最佳答案

已解决

set(Boost_USE_STATIC_LIBS ON)

...now CMake finds boost libraries! Although my CMakeLists.txt has set(USE_STATIC_BOOST ON) which must have the same effect, but it doesnt...

To use set(Boost_USE_STATIC_LIBS OFF) you need to add:

if( WIN32 )
# Needed for boost to turn off autolinking for dynamic linking
add_definitions( -DBOOST_ALL_NO_LIB )
endif()

查看更多信息: Linking boost library with Boost_USE_STATIC_LIB OFF on Windows

关于c++ - CMake 没有找到 boost ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13223707/

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