CMake与Boost无法找到静态库(CMake with Boost could not find static libraries)

编程入门 行业动态 更新时间:2024-10-11 15:16:10
CMake与Boost无法找到静态库(CMake with Boost could not find static libraries)

我有一些CMake和Boost库的麻烦。 我有以下错误:

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1111 (message): Unable to find the requested Boost libraries. Boost version: 1.55.0 Boost include path: C:/local/boost_1_55_0 Could not find the following static Boost libraries: boost_system boost_date_time boost_regex 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. Call Stack (most recent call first): CMakeLists.txt:10 (find_package) -- Configuring incomplete, errors occurred!

我在我的CMakeLists.txt中完成了我在互联网上找到的所有内容,但它不起作用,我不明白。 我在Visual Studio 12中使用Windows 8,而Boost安装在默认目录中。 (C:/本地/ boost_1_55_0)

这里我的CMakeLists.txt:

cmake_minimum_required(VERSION 2.6) project (server) set(BOOST_ROOT "c:\\local\\boost_1_55_0") set (Boost_USE_STATIC_LIBS ON) set (Boost_MULTITHREADED ON) set (Boost_USE_STATIC_RUNTIME OFF) find_package(Boost 1.55 COMPONENTS system date_time regex REQUIRED) add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) set(SRCS main.cpp Server.cpp Client.cpp) set(HEADERS Server.h Client.h) include_directories(${Boost_INCLUDE_DIR}) add_executable(babel_server ${SRCS} ${HEADERS}) target_link_libraries(babel_server ${Boost_LIBRARIES})

任何人都可以帮助我吗?

谢谢

I have some troubles with CMake and Boost library. I have the following error :

CMake Error at C:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1111 (message): Unable to find the requested Boost libraries. Boost version: 1.55.0 Boost include path: C:/local/boost_1_55_0 Could not find the following static Boost libraries: boost_system boost_date_time boost_regex 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. Call Stack (most recent call first): CMakeLists.txt:10 (find_package) -- Configuring incomplete, errors occurred!

I did everything I found to internet in my CMakeLists.txt but it's not working, I don't understand. I'm using Windows 8 with Visual Studio 12 and Boost is installed in the default directory. (C:/local/boost_1_55_0)

Here my CMakeLists.txt :

cmake_minimum_required(VERSION 2.6) project (server) set(BOOST_ROOT "c:\\local\\boost_1_55_0") set (Boost_USE_STATIC_LIBS ON) set (Boost_MULTITHREADED ON) set (Boost_USE_STATIC_RUNTIME OFF) find_package(Boost 1.55 COMPONENTS system date_time regex REQUIRED) add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) set(SRCS main.cpp Server.cpp Client.cpp) set(HEADERS Server.h Client.h) include_directories(${Boost_INCLUDE_DIR}) add_executable(babel_server ${SRCS} ${HEADERS}) target_link_libraries(babel_server ${Boost_LIBRARIES})

Anyone can help me please ?

Thanks

最满意答案

我猜你的编译库不在你的BOOST_ROOT / lib /文件夹中。 在这种情况下,您需要设置您的lib文件夹目录路径。

set(BOOST_LIBRARYDIR ${BOOST_ROOT}/stage/lib/)

要么

set(BOOST_LIBRARYDIR path/to/your/lib/folder)

I guess your compiled libraries is not in your BOOST_ROOT/lib/ folder. In this case, you need to set your lib folder directory path.

set(BOOST_LIBRARYDIR ${BOOST_ROOT}/stage/lib/)

or

set(BOOST_LIBRARYDIR path/to/your/lib/folder)

更多推荐

本文发布于:2023-08-04 09:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1413880.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:静态   Boost   CMake   libraries   static

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!