0

For the past month I've been looking at WAMP and Autobanh|Cpp and I decided to start experimenting. I've successfully installed Autobahn and cloned Autobahn|Cpp library (and the examples) from this. But there seems to be an issue with building the examples (using Scons). Example call2.cpp relies on Boost composite futures using 'when_all' to wait for either one or all the composed operations to complete before continuing.

From the console output, it seems 'when_all' was not declared:

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:

I'm just wondering why this is not working and what did I miss.

fguertin
  • 3
  • 2

2 Answers2

1

Your Boost is too old. See here and here. You need at least 1.56.

Also (not necessary, but): do yourself a favor and use a decent compiler;)

oberstet
  • 21,353
  • 10
  • 64
  • 97
  • I get it. Let me download and build version *1.56* and see if this fix everything. – fguertin Jan 05 '15 at 21:37
  • I did change to Boost **1.56** and now all the 'when_all' declarations are correctly resolved. – fguertin Jan 07 '15 at 00:18
  • I'm a big fan of clang but I think an argument could be made that GCC qualifies as at least a **decent** compiler ;) – Huhwha Jan 09 '15 at 14:42
  • A decent compiler does give decent error messages. If you are into heavily templated stuff, I think an argument could be made that GCC does not qualify;) Well, let's stop the flamewar though .. GCC is a fine compiler, sure. – oberstet Jan 09 '15 at 17:35
0

Do you have

#define BOOST_THREAD_PROVIDES_FUTURE
#define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION
#define BOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY

or the corresponding compiler flags?

sehe
  • 374,641
  • 47
  • 450
  • 633
  • Yes I do. In fact, call2.cpp includes AutobahnCpp.hpp which includes those. I wonder what else I need to build these committed examples [https://github.com/tavendo/AutobahnCpp/tree/master/examples]. – fguertin Jan 05 '15 at 16:24