小编Mas*_*ass的帖子

无法编译 boost:: Fiber 官方示例

我正在尝试 boost:: Fiber 库,但无法使用 boost Fiber 编译代码。于是我转而编译运行boost官方的例子。我安装了最新版本的boost库1.65.1,安装似乎没问题。我执行以下命令来编译 simple.cpp

g++ -I /usr/local/include/boost/ -L /usr/local/lib/ -lboost_fiber -std=c++11 libs/fiber/examples/simple.cpp    
Run Code Online (Sandbox Code Playgroud)

但我收到以下抱怨:

/tmp/ccWQ5ZMf.o: In function `main':
simple.cpp:(.text+0x7b): undefined reference to `boost::fibers::fiber::join()'
/tmp/ccWQ5ZMf.o: In function `boost::context::continuation::~continuation()':
simple.cpp:(.text._ZN5boost7context12continuationD2Ev[_ZN5boost7context12continuationD5Ev]+0x59): undefined reference to `ontop_fcontext'
/tmp/ccWQ5ZMf.o: In function `boost::context::continuation::resume()':
simple.cpp:(.text._ZN5boost7context12continuation6resumeEv[_ZN5boost7context12continuation6resumeEv]+0x68): undefined reference to `jump_fcontext'
/tmp/ccWQ5ZMf.o: In function `boost::fibers::context::context(unsigned long, boost::fibers::type, boost::fibers::launch)':
simple.cpp:(.text._ZN5boost6fibers7contextC2EmNS0_4typeENS0_6launchE[_ZN5boost6fibers7contextC5EmNS0_4typeENS0_6launchE]+0x18): undefined reference to `vtable for boost::fibers::context'
/tmp/ccWQ5ZMf.o: In function `boost::fibers::fiber::get_id() const':
simple.cpp:(.text._ZNK5boost6fibers5fiber6get_idEv[_ZNK5boost6fibers5fiber6get_idEv]+0x3b): undefined reference to `boost::fibers::context::get_id() const'
/tmp/ccWQ5ZMf.o: In function `boost::this_fiber::yield()':
simple.cpp:(.text._ZN5boost10this_fiber5yieldEv[_ZN5boost10this_fiber5yieldEv]+0x5): undefined reference to `boost::fibers::context::active()'
simple.cpp:(.text._ZN5boost10this_fiber5yieldEv[_ZN5boost10this_fiber5yieldEv]+0xd): undefined …
Run Code Online (Sandbox Code Playgroud)

c++ boost fibers

2
推荐指数
1
解决办法
2234
查看次数

标签 统计

boost ×1

c++ ×1

fibers ×1