- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试包括 Boost
我项目中的库,并且一直面临同样的问题。我在带有 Codeblocks IDE 的 Ubuntu 12.10 上,并尝试手动安装库,从站点读取说明,但在 header 和使用前构建的库中出现错误。
然后我通过终端安装库 sudo apt-get install libboost-all-dev
.在此之后,在我的 Codeblocks 程序中,我可以包含像 #include <boost/regex.hpp>
这样的标题。但是当我尝试包含文件系统库 ( #include "boost/filesystem/operations.hpp"
) 的 header 时,出现以下错误:
/usr/include/boost/system/error_code.hpp|214|undefined reference to boost::system::generic_category()'|
我不确定如何解决这个错误(特别是在 Linux 上的代码块中)。我真的需要一些帮助。
编译器:Gcc
程序代码: 仅尝试包含上述文件系统operations.hpp
文件。
从代码块构建日志:
Build started on: 20-11-2012 at 18:02.53
Build ended on: 20-11-2012 at 18:02.54
-------------- Build: Debug in libopenFrameworks ---------------
Target is up to date.
-------------- Build: Debug in reader1 ---------------
make -s -f Makefile Debug
linking i686 bin/reader1_debug linux
obj/i686Debug/src/testApp.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
obj/i686Debug/src/main.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::generic_category()'
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
make: *** [bin/reader1_debug] Error 1
Process terminated with status 2 (0 minutes, 1 seconds)
6 errors, 0 warnings
最佳答案
您应该链接到 libboost_system
库中。我不确定代码块,但你平台上的 g++ 命令行选项是
-lboost_system
关于C++ Boost:对 boost::system::generic_category() 的 undefined reference ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34155210/
引自 C++11 标准: 19.5.1.5 Error category objects [syserr.errcat.objects] const error_category& system_c
看来我看不到明显的东西。我想为我的项目使用一些 Boost 库功能,并且知道我突然遇到了这些好错误: Linking CXX executable ATFOR CMakeFiles/ATFOR.dir
我在这里缺少哪些链接器标志? 我尝试在 Ubuntu 18.04 LTS 上编译它但它失败了,它在 Debian 9 docker 镜像中运行: #include // Trying to comp
C++0x 有两个预定义的 error_category对象:generic_category()和 system_category() .据我目前所知,system_category()应该用于操作
如果我没有输入 -lboost_system,我会理解此错误消息。标志,但它真的在这里: g++ -o build/myproject build/main/main.o -L/usr/local/b
让我快速解决问题。我有一个依赖于 boost 的库“serial”,它是在 cmake 中设置的,我安装了一个 Findserial.cmake 来帮助我的第二个库“xbow_400”找到它。这一切都
我正在尝试将最新的 boost 库 (1.60) 链接到我的 Qt 项目。不幸的是,它总是显示“C++ Boost:对 boost::system::generic_category() 的 unde
我正在尝试包括 Boost我项目中的库,并且一直面临同样的问题。我在带有 Codeblocks IDE 的 Ubuntu 12.10 上,并尝试手动安装库,从站点读取说明,但在 header 和使用前
目前正在尝试在 Qt 应用程序中使用 boost 线程(我知道 Qt 有自己的线程函数,但在这里我使用的是 boost)但是无论我做什么我都会遇到链接器错误。网上有很多关于这个问题的问题,但到目前为止
这个问题在这里已经有了答案: What is an undefined reference/unresolved external symbol error and how do I fix it?
我正在尝试包含 Boost我项目中的库,并且一直面临同样的问题。我在带有 Codeblocks IDE 的 Ubuntu 12.10 上,并尝试手动安装库,从站点读取说明,但在 header 和使用前
我正在尝试在 CodeBlocks 中编译这段代码 #include #include using namespace boost::filesystem; int main() { if (
我想在我的项目中使用 boost.asio header ,但是当我包含它的 .hpp 文件时,我在编译时遇到了这个输出错误: 我需要 boost.asio 来让 crow 路由我的网络请求。 /ho
OK,所以我一直在关注this教程。 我按照提示进行了所有设置(仔细检查了所有内容),唯一更改的是(步骤10),从 ${OGRE_HOME}\boost_1_44 至 ${OGRE_HOME}\boo
我第一次尝试在 C++ 中使用 mongodb。我刚刚在 Ubuntu 上安装了最新版本,还安装了最新的 v2.0 c++ 驱动程序代码。它使用 scons 编译得很好。在 c++ 文件中,以下是我的
我是一名优秀的程序员,十分优秀!