- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试编译一个需要 Boost 的 CPP 库。我在 Ubuntu 下。
在我的一个文件中,我包含了一个 boost header
#include <boost/function.hpp>
这是CMakeLists.txt
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
find_package(Boost COMPONENTS filesystem system serialization REQUIRED)
set(CAN_MASTER_INCLUDE_DIR include)
include_directories( ${Boost_INCLUDE_DIR}
${CAN_MASTER_INCLUDE_DIR}
${CAN_MASTER_INCLUDE_DIR}/boost #this is not the boost I'm talking about
${CAN_MASTER_INCLUDE_DIR}/timers_rtpreempt
${CAN_MASTER_INCLUDE_DIR}/timers_unix
${CAN_MASTER_INCLUDE_DIR}/timers_xeno
${CAN_MASTER_INCLUDE_DIR}/unix
)
LINK_DIRECTORIES($ENV{HOME}/Projects/canmaster/bin)
set(CAN_FESTIVAL_CPP drivers/unix/unix.c
drivers/timers_xeno/timers_xeno.c
)
add_library(canfestival ${CAN_FESTIVAL_CPP})
当我尝试编译 cd buil && cmake .. && make VERBOSE=1
时,它返回以下错误:
/usr/bin/cmake -H/home/luca/ArmIkarus/canmaster -B/home/luca/ArmIkarus/canmaster/build_cmake --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles /home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory `/home/luca/ArmIkarus/canmaster/build_cmake'
make -f CMakeFiles/canfestival.dir/build.make CMakeFiles/canfestival.dir/depend
make[2]: Entering directory `/home/luca/ArmIkarus/canmaster/build_cmake'
cd /home/luca/ArmIkarus/canmaster/build_cmake && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/luca/ArmIkarus/canmaster /home/luca/ArmIkarus/canmaster /home/luca/ArmIkarus/canmaster/build_cmake /home/luca/ArmIkarus/canmaster/build_cmake /home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles/canfestival.dir/DependInfo.cmake --color=
Dependee "/home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles/canfestival.dir/depend.internal".
Scanning dependencies of target canfestival
make[2]: Leaving directory `/home/luca/ArmIkarus/canmaster/build_cmake'
make -f CMakeFiles/canfestival.dir/build.make CMakeFiles/canfestival.dir/build
make[2]: Entering directory `/home/luca/ArmIkarus/canmaster/build_cmake'
/usr/bin/cmake -E cmake_progress_report /home/luca/ArmIkarus/canmaster/build_cmake/CMakeFiles 1
[ 10%] Building C object CMakeFiles/canfestival.dir/drivers/unix/unix.o
/usr/bin/gcc -I/home/luca/ArmIkarus/canmaster/include -I/home/luca/ArmIkarus/canmaster/include/boost -I/home/luca/ArmIkarus/canmaster/include/timers_rtpreempt -I/home/luca/ArmIkarus/canmaster/include/timers_unix -I/home/luca/ArmIkarus/canmaster/include/timers_xeno -I/home/luca/ArmIkarus/canmaster/include/unix -o CMakeFiles/canfestival.dir/drivers/unix/unix.o -c /home/luca/ArmIkarus/canmaster/drivers/unix/unix.c
In file included from /home/luca/ArmIkarus/canmaster/include/can.h:28:0,
from /home/luca/ArmIkarus/canmaster/include/canDispatch.h:23,
from /home/luca/ArmIkarus/canmaster/drivers/unix/unix.c:36:
/usr/include/boost/function.hpp:13:57: fatal error: functional: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/canfestival.dir/drivers/unix/unix.o] Error 1
make[2]: Leaving directory `/home/luca/ArmIkarus/canmaster/build_cmake'
make[1]: *** [CMakeFiles/canfestival.dir/all] Error 2
make[1]: Leaving directory `/home/luca/ArmIkarus/canmaster/build_cmake'
make: *** [all] Error 2
好像没有包含boost路径。如果我尝试在 CMakeLists.txt
中用 /usr/include
替换 ${Boost_INCLUDE_DIR}
也是一样的。
我该如何解决?
编辑
这是boost调试的结果:
luca@luca-vmware:~/ArmIkarus/canmaster/build_cmake$ cmake -DBoost_DEBUG=ON ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- 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
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:525 ] Boost not in cache
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:528 ] _boost_TEST_VERSIONS = 1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:530 ] Boost_USE_MULTITHREADED = TRUE
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:532 ] Boost_USE_STATIC_LIBS =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:534 ] Boost_USE_STATIC_RUNTIME =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:536 ] Boost_ADDITIONAL_VERSIONS =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:538 ] Boost_NO_SYSTEM_PATHS =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:606 ] Declared as CMake or Environmental Variables:
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:608 ] BOOST_ROOT =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:610 ] BOOST_INCLUDEDIR =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:612 ] BOOST_LIBRARYDIR =
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:614 ] _boost_TEST_VERSIONS = 1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33.0;1.33
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:667 ] Include debugging info:
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:669 ] _boost_INCLUDE_SEARCH_DIRS = C:/boost/include;C:/boost;/boost/include;/boost;/sw/local/include
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:671 ] _boost_PATH_SUFFIXES = boost-1_48_0;boost_1_48_0;boost-1_48;boost_1_48;boost-1_47_0;boost_1_47_0;boost-1_47;boost_1_47;boost-1_46_1;boost_1_46_1;boost-1_46_0;boost_1_46_0;boost-1_46;boost_1_46;boost-1_45_0;boost_1_45_0;boost-1_45;boost_1_45;boost-1_44_0;boost_1_44_0;boost-1_44;boost_1_44;boost-1_43_0;boost_1_43_0;boost-1_43;boost_1_43;boost-1_42_0;boost_1_42_0;boost-1_42;boost_1_42;boost-1_41_0;boost_1_41_0;boost-1_41;boost_1_41;boost-1_40_0;boost_1_40_0;boost-1_40;boost_1_40;boost-1_39_0;boost_1_39_0;boost-1_39;boost_1_39;boost-1_38_0;boost_1_38_0;boost-1_38;boost_1_38;boost-1_37_0;boost_1_37_0;boost-1_37;boost_1_37;boost-1_36_1;boost_1_36_1;boost-1_36_0;boost_1_36_0;boost-1_36;boost_1_36;boost-1_35_1;boost_1_35_1;boost-1_35_0;boost_1_35_0;boost-1_35;boost_1_35;boost-1_34_1;boost_1_34_1;boost-1_34_0;boost_1_34_0;boost-1_34;boost_1_34;boost-1_33_1;boost_1_33_1;boost-1_33_0;boost_1_33_0;boost-1_33;boost_1_33
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:696 ] location of version.hpp: /usr/include/boost/version.hpp
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:715 ] version.hpp reveals boost 1.46.1
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:808 ] guessed _boost_COMPILER = -gcc46
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:818 ] _boost_MULTITHREADED = -mt
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:861 ] _boost_RELEASE_ABI_TAG = -
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:863 ] _boost_DEBUG_ABI_TAG = -d
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:906 ] _boost_LIBRARY_SEARCH_DIRS = /usr/include/lib;/usr/include/../lib;/usr/include/stage/lib;C:/boost/lib;C:/boost;/boost/boost_1_46_1/lib;/boost/boost_1_46/lib;/boost/lib;/boost;/sw/local/lib
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:977 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-gcc46-mt-1_46_1;boost_filesystem-gcc46-mt;boost_filesystem-mt-1_46_1;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1009 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-gcc46-mt-d-1_46_1;boost_filesystem-gcc46-mt-d;boost_filesystem-mt-d-1_46_1;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:977 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-gcc46-mt-1_46_1;boost_system-gcc46-mt;boost_system-mt-1_46_1;boost_system-mt;boost_system
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1009 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-gcc46-mt-d-1_46_1;boost_system-gcc46-mt-d;boost_system-mt-d-1_46_1;boost_system-mt-d;boost_system-mt;boost_system
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:977 ] Searching for SERIALIZATION_LIBRARY_RELEASE: boost_serialization-gcc46-mt-1_46_1;boost_serialization-gcc46-mt;boost_serialization-mt-1_46_1;boost_serialization-mt;boost_serialization
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1009 ] Searching for SERIALIZATION_LIBRARY_DEBUG: boost_serialization-gcc46-mt-d-1_46_1;boost_serialization-gcc46-mt-d;boost_serialization-mt-d-1_46_1;boost_serialization-mt-d;boost_serialization-mt;boost_serialization
-- [ /usr/share/cmake-2.8/Modules/FindBoost.cmake:1119 ] Boost_FOUND = TRUE
-- Boost version: 1.46.1
-- Found the following Boost libraries:
-- filesystem
-- system
-- serialization
-- Configuring done
-- Generating done
-- Build files have been written to: /home/luca/ArmIkarus/canmaster/build_cmake
luca@luca-vmware:~/ArmIkarus/canmaster/build_cmake$ make
Scanning dependencies of target canfestival
[ 10%] Building C object CMakeFiles/canfestival.dir/drivers/unix/unix.o
In file included from /home/luca/ArmIkarus/canmaster/include/can.h:28:0,
from /home/luca/ArmIkarus/canmaster/include/canDispatch.h:23,
from /home/luca/ArmIkarus/canmaster/drivers/unix/unix.c:36:
/usr/include/boost/function.hpp:13:57: fatal error: functional: No such file or directory
compilation terminated.
make[2]: *** [CMakeFiles/canfestival.dir/drivers/unix/unix.o] Error 1
make[1]: *** [CMakeFiles/canfestival.dir/all] Error 2
make: *** [all] Error 2
最佳答案
试试这个,根据需要调整设置和版本:
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package( Boost 1.52.0 COMPONENTS date_time filesystem system )
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(canfestival ${Boost_LIBRARIES})
endif()
编辑:
我之前忽略了它,但考虑到您的源文件是 .c 而不是 .cpp cmake 正在(正确地)将您的库编译为 C 对象,正如您在调试输出中看到的那样:
[ 10%] Building C object CMakeFiles/canfestival.dir/drivers/unix/unix.o
比较:
[ 2%] Building CXX object src/CMakeFiles/smolder.dir/os/linux/main.cpp.o
Boost 是一个 C++ 库,所以您看到的错误是因为它不理解 function.hpp 头文件结构,特别是第一个包括:
fatal error :功能性:没有这样的文件或目录编译终止。
#include<functional>
是function.hpp中的第一行
编辑以供将来引用:我最初的建议是将源文件更改为 .cpp,但这可以通过以下方式强制执行:
project(FOOBAR CXX)
关于c++ - CMakeLists 不会包含 Boost header ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13849373/
我有一个类似于以下的结构。 class A { string title; List bItem; } class B { int pric
本地流 和 远程流 两者都是“媒体流列表 ”。 本地流 包含“本地媒体流 ” 对象 但是,远程流 包含“媒体流 ” 对象 为什么差别这么大? 当我使用“本地流 “- 这个对我有用: localVide
我正在尝试将 8 列虚拟变量转换为 8 级排名的一列。 我试图用这个公式来做到这一点: =IF(OR(A1="1");"1";IF(OR(B1="1");"2";IF(OR(C1="1");"3";I
我正在使用面向对象编程在 Python 中创建一个有点复杂的棋盘游戏的实现。 我的问题是,许多这些对象应该能够与其他对象交互,即使它们不包含在其中。 例如Game是一个对象,其中包含PointTrac
有没有办法获取与 contains 语句匹配的最深元素? 基本上,如果我有嵌套的 div,我想要最后一个元素而不是父元素: Needle $("div:contains('Needle')")
出于某种原因,我无法在 Google 上找到答案!但是使用 SQL contains 函数我怎么能告诉它从字符串的开头开始,即我正在寻找等同于的全文 喜欢 'some_term%'。 我知道我可以使用
我正在尝试创建一个正则表达式来匹配具有 3 个或更多元音的字符串。 我试过这个: [aeiou]{3,} 但它仅在元音按顺序排列时才有效。有什么建议吗? 例如: 塞缪尔 -> 有效 琼 -> 无效 S
嘿所以我遇到了这样的情况,我从数据库中拉回一个客户,并通过包含的方式包含所有案例研究 return (from c in db.Clients.Include("CaseStudies")
如果关键字是子字符串,我无法弄清楚为什么这个函数不返回结果。 const string = 'cake'; const substring = 'cak'; console.log(string.in
我正在尝试将包含特定文本字符串的任何元素更改为红色。在我的示例中,我可以将子元素变为蓝色,但是我编写“替换我”行的方式有些不正确;红色不会发生变化。我注意到“contains”方法通常写为 :cont
我想问一下我是否可以要求/包含一个语法错误的文件,如果不能,则require/include返回一个值,这样我就知道所需/包含的文件存在语法错误并且不能被要求/包含? file.php语法错误 inc
我想为所有包含youtube链接的链接添加一个rel。 这就是我正在使用的东西-但它没有用。有任何想法吗? $('a [href:contains(“youtube.com”)]')。attr('re
我正在尝试在 Elasticsearch 中查询。除搜索中出现“/”外,此功能均正常运行。查询如下所示 GET styling_rules/product_line_filters/_search {
我正在开发名为eBookRepository的ASP.NET MVC应用程序,其中包含在线图书。 电子书具有自己的标题,作者等。因此,现在我正在尝试实现搜索机制。我必须使用Elasticsearch作
我已阅读Firebase Documentation并且不明白什么是 .contains()。 以下是文档中 Firebase 数据库的示例规则: { "rules": { "rooms"
我的问题是我可以给出条件[ 'BookTitleMaster.id' => $xtitid, ] 如下所示 $bbookinfs = $this->BookStockin->BookIssue->fi
我需要能够使用 | 检查模式在他们中。例如,对于像“dtest|test”这样的字符串,像 d*|*t 这样的表达式应该返回 true。 我不是正则表达式英雄,所以我只是尝试了一些事情,例如: Reg
我想创建一个正则表达式来不匹配某些单词... 我的字符:var test = "é123rr;and;ià456;or;456543" 我的正则表达式:test.match(\((?!and)(?!o
我在 XSLT 中有一个名为 variable_name 的变量,如果相关产品具有名称为 A 或 B 或两者均为 A & 的属性,我将尝试将其设置为 1 B.
您好,我想让接待员和经理能够查看工作类型和费率并随后进行更新。但是技术人员只能查看不能更新。该图是否有效? 我读到扩展用例是由发起基本用例的参与者发起的。我应该如何区分技术人员只能启动基本案例而不能启
我是一名优秀的程序员,十分优秀!