CMake的找不到任何提升不再 [英] Cmake cannot find Boost any longer

查看:252
本文介绍了CMake的找不到任何提升不再的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

直到昨天,我的程序编译和链接正确。从今天起,同样的程序(相同的来源和相同的环境),没有链接。 Boost库是找不到的。

Until yesterday, my program compiled and linked correctly. Since today, the same program (same source and same environment), does not link. The boost library is not found.

顶的CMakeLists.txt文件:

Top of CMakeLists.txt file:

...
find_package (Boost REQUIRED)
set (Boost_USE_STATIC_LIBS ON)
set (Boost_USE_MULTITHREADED OFF)
set (Boost_USE_STATIC_RUNTIME OFF)
find_package (Boost COMPONENTS program_options)

if (Boost_FOUND)
    include_directories(${Boost_INCLUDE_DIRS})
endif()
...

运行cmake的:

Running cmake:

cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCUMENTATION=ON ../NumberPuncher/
-- The C compiler identification is GNU 4.7.1
-- The CXX compiler identification is GNU 4.7.1
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Boost version: 1.49.0
-- Could NOT find Boost
-- Configuring done
-- Generating done
-- Build files have been written to: /SWEnvironment/sw/NumberPuncher_prj/Release

行:

- 升压版本:1.49.0

-- Boost version: 1.49.0

是错误的,因为我已经安装了升压为1.54.0。但是,在的CMakeLists.txt文件,未指定升压版本,它不需要是

is wrong, since the Boost I have installed is 1.54.0. However, in the CMakeLists.txt file, the boost version is not specified and it does not need to be.

建设方案,我得到相对提升这种链接错误:

Building the program, I get link errors relative to Boost of this kind:

entrypoint.cpp:(.text.startup+0x6be): undefined reference to `boost::program_options::options_description::add_options()'

起初我还以为包含提振目录已被删除,但它仍然是存在的。

At first I thought the directory containing Boost had been removed, but it is still there.

我做了一个干净的构建,重新运行cmake的,但问题仍然存在。

I made a clean build, rerunning cmake, but the problem remains.

任何想法?

环境:结果
在Linux OpenSUSE 12.2结果
GCC / G ++ 4.7.1结果
升压1.54.0

Environment:
Linux OpenSuse 12.2
GCC/G++ 4.7.1
Boost 1.54.0

推荐答案

移动 find_package(升压组件program_options)命令,其中的 find_package(升压必填)已解决了这一问题:

Moving the find_package(Boost COMPONENTS program_options) command where the find_package(Boost REQUIRED) was fixed the problem:

find_package (Boost COMPONENTS program_options)
set (Boost_USE_STATIC_LIBS ON)
set (Boost_USE_MULTITHREADED OFF)
set (Boost_USE_STATIC_RUNTIME OFF)

我仍然无法理解为何在过去总是工作。如果有人可以澄清,我将AP preciate。反正现在应该在今后的工作了。

I still cannot understand why it has always worked in the past. If anybody could clarify that I would appreciate. Anyway now it should work in the future, too.

这篇关于CMake的找不到任何提升不再的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆