Autobanh | Cpp和Boost :: when_all复合期货

时间:2015-01-05 14:40:04

标签: boost autobahn

过去一个月我一直在看WAMP和Autobanh | Cpp,我决定开始尝试。我已成功安装了Autobahn并从this克隆了Autobahn | Cpp库(以及示例)。 但是构建示例似乎存在问题(使用Scons)。示例call2.cpp依赖于Boost复合期货使用' when_all'在继续之前等待一个或所有组合操作完成。

从控制台输出,似乎' when_all'未被宣布:

fguertin@BBBRTH5DEV01:~/Desktop/AutobahnCpp$ scons
scons: Reading SConscript files ...
Using GNU toolchain
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/examples/call2.o -c -std=c++11 -O2 -Wall -pedantic -Wno-deprecate-declarations -Wno-unused-local-typedefs -Wl,--no-as-needed -pthread -I/home/fguertin/boost_1_55_0-x86 -I/home/fguertin/msgpack-c/include -Iautobahn examples/call2.cpp
examples/call2.cpp: In lambda function:
examples/call2.cpp:128:85: error: 'when_all' was not declared in this scope
               auto finish = when_all(std::move(c0), std::move(c1), std::move(c2));
                             ^
In file included from /home/fguertin/boost_1_55_0-x86/boost/asio/detail/impl/posix_event.ipp:24:0,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/detail/posix_event.hpp:95,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/detail/event.hpp:25,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/detail/task_io_service_thread_info.hpp:18,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/impl/handler_alloc_hook.ipp:26,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/handler_alloc_hook.hpp:80,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/detail/handler_alloc_helpers.hpp:21,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/detail/bind_handler.hpp:19,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/detail/wrapped_handler.hpp:18,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/io_service.hpp:24,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/basic_io_object.hpp:19,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/basic_socket.hpp:20,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio/basic_datagram_socket.hpp:20,
                 from /home/fguertin/boost_1_55_0-x86/boost/asio.hpp:21,
                 from autobahn/autobahn.hpp:42,
                 from examples/call2.cpp:31:

我只是想知道为什么这不起作用,我错过了什么。

2 个答案:

答案 0 :(得分:1)

你的Boost太老了。请参阅herehere。您至少需要 1.56

另外(不是必须的,但是):帮自己一个忙,并使用decent compiler;)

答案 1 :(得分:0)

你有吗

#define BOOST_THREAD_PROVIDES_FUTURE
#define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION
#define BOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY

或相应的编译器标志?