首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >升压连接误差

升压连接误差
EN

Stack Overflow用户
提问于 2010-11-23 18:53:10
回答 1查看 9.2K关注 0票数 2

所以,我正在尝试使用boost.process库。我从/usr/include/boost,下载了包,并将包含从boost子目录复制到这个位置中,编写了一个简单的代码:

代码语言:javascript
运行
复制
    namespace bp = ::boost::process;
    std::string execApp = "make";
    std::vector<std::string> args;
    args.push_back("-C ../build");

    bp::context ctx;
    ctx.stdout_behavior = bp::silence_stream();

    bp::child buildProcess = bp::launch(execApp, args, ctx);

它编译但在链接器上失败:

代码语言:javascript
运行
复制
CMakeFiles/DebugConsole.dir/Debug/DebugConsole.cpp.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost/system/error_code.hpp:208: undefined reference to `boost::system::get_system_category()'
/usr/include/boost/system/error_code.hpp:209: undefined reference to `boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:214: undefined reference to `boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:215: undefined reference to `boost::system::get_generic_category()'
/usr/include/boost/system/error_code.hpp:216: undefined reference to `boost::system::get_system_category()'
CMakeFiles/DebugConsole.dir/Debug/DebugConsole.cpp.o: In function `boost::process::detail::file_handle::posix_remap(int)':
/usr/include/boost/process/detail/file_handle.hpp:264: undefined reference to `boost::system::get_system_category()'
/usr/include/boost/process/detail/file_handle.hpp:269: undefined reference to `boost::system::get_system_category()'
CMakeFiles/DebugConsole.dir/Debug/DebugConsole.cpp.o: In function `boost::process::detail::file_handle::posix_dup(int, int)':
/usr/include/boost/process/detail/file_handle.hpp:295: undefined reference to `boost::system::get_system_category()'
CMakeFiles/DebugConsole.dir/Debug/DebugConsole.cpp.o: In function `pipe':
/usr/include/boost/process/detail/pipe.hpp:86: undefined reference to `boost::system::get_system_category()'
CMakeFiles/DebugConsole.dir/Debug/DebugConsole.cpp.o:/usr/include/boost/process/detail/posix_ops.hpp:202: more undefined references to `boost::system::get_system_category()' follow
collect2: ld returned 1 exit status

我已经链接过这样的库:filesystem system date_time

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-11-23 18:55:47

你可能想看看最后一个答案,这里。

我有一个非常相似的问题,在搜索时发现了这篇文章。经过更多的搜索后,我设法解决了这个问题,所以我把它发到这里给其他人看。 我必须以这种方式链接到适当的库: g++ boost_example.cpp -o run _ http://linux.overshoot.tv/ticket/127 -mthttp://linux.overshoot.tv/ticket/127。 真正的问题是缺乏boost文档,没有说明要链接到哪个库。请参阅:http://linux.overshoot.tv/ticket/129 无论如何,若要使用boost/file_system,请链接到:-lboost_filesystem-mt。 另见:http://ubuntuforums.org/showthread.php?t=244593

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4259642

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档