[Accumulators + Signals2] Compilation error with GCC when both are used

Hello, It seems that Accumulators and Signals2 have problems to coexist. For instance, look at the following simple C++ program: --- [c++] --- #include <boost/accumulators/accumulators.hpp> #include <boost/accumulators/statistics/stats.hpp> #include <boost/accumulators/statistics/mean.hpp> #include <boost/signals2.hpp> int main() { } --- [/c++] --- If I compile it with GCC 4.6.0 (under Fedora Linux 15 x86_64): $ g++ -Wall -Wextra -pedantic -ansi -I,/boost-trunk -o boost_signals2_accumulators boost_signals2_accumulators.cpp I get the following errors: --- [error] --- In file included from ./boost-trunk/boost/signals2.hpp:20:0, from boost_signals2_accumulators.cpp:4: ./boost-trunk/boost/signals2/signal_type.hpp:29:2: error: #error This header requires BOOST_PARAMETER_MAX_ARITY to be defined as 7 or greater prior to including Boost.Parameter headers In file included from ./boost-trunk/boost/signals2.hpp:20:0, from boost_signals2_accumulators.cpp:4: ./boost-trunk/boost/signals2/signal_type.hpp:78:9: error: wrong number of template arguments (6, should be 5) ./boost-trunk/boost/parameter/parameters.hpp:714:8: error: provided for ‘template<class PS0, class PS1, class PS2, class PS3, class PS4> struct boost::parameter::parameters’ ./boost-trunk/boost/signals2/signal_type.hpp:83:9: error: ‘parameter_spec’ is not a class or namespace ./boost-trunk/boost/signals2/signal_type.hpp:83:29: error: expected unqualified-id before ‘<’ token ./boost-trunk/boost/signals2/signal_type.hpp:99:11: error: ‘args’ was not declared in this scope ./boost-trunk/boost/signals2/signal_type.hpp:105:9: error: template argument 1 is invalid ./boost-trunk/boost/signals2/signal_type.hpp:108:31: error: ‘args’ was not declared in this scope ./boost-trunk/boost/signals2/signal_type.hpp:108:67: error: template argument 1 is invalid ./boost-trunk/boost/signals2/signal_type.hpp:111:31: error: ‘args’ was not declared in this scope ./boost-trunk/boost/signals2/signal_type.hpp:111:94: error: template argument 1 is invalid ./boost-trunk/boost/signals2/signal_type.hpp:115:31: error: ‘args’ was not declared in this scope ./boost-trunk/boost/signals2/signal_type.hpp:115:97: error: template argument 1 is invalid ./boost-trunk/boost/signals2/signal_type.hpp:121:13: error: ‘args’ was not declared in this scope ./boost-trunk/boost/signals2/signal_type.hpp:124:11: error: template argument 1 is invalid ./boost-trunk/boost/signals2/signal_type.hpp:128:31: error: ‘args’ was not declared in this scope ./boost-trunk/boost/signals2/signal_type.hpp:128:69: error: template argument 1 is invalid --- [/error] --- I've tried both with last Boost devel version and Boost 1.46.0. Note, I have no problem if one of the two libraries are not used (e.g. if I comment either the first 3 #includes or the last one). Any idea? Thank you very much!! Best, -- Marco

On Jun 9, 2011, at 9:04 AM, sguazt wrote:
Hello,
It seems that Accumulators and Signals2 have problems to coexist. For instance, look at the following simple C++ program:
--- [c++] --- #include <boost/accumulators/accumulators.hpp> #include <boost/accumulators/statistics/stats.hpp> #include <boost/accumulators/statistics/mean.hpp> #include <boost/signals2.hpp>
int main() { } In file included from ./boost-trunk/boost/signals2.hpp:20:0, from boost_signals2_accumulators.cpp:4: ./boost-trunk/boost/signals2/signal_type.hpp:29:2: error: #error This header requires BOOST_PARAMETER_MAX_ARITY to be defined as 7 or greater prior to including Boost.Parameter headers
The error is pretty clear and #define BOOST_PARAMETER_MAX_ARITY 7 at the top of your program fixes it. Cheers, Gordon

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday, June 09, 2011, sguazt wrote:
I get the following errors: --- [error] --- In file included from ./boost-trunk/boost/signals2.hpp:20:0, from boost_signals2_accumulators.cpp:4: ./boost-trunk/boost/signals2/signal_type.hpp:29:2: error: #error This header requires BOOST_PARAMETER_MAX_ARITY to be defined as 7 or greater prior to including Boost.Parameter headers
BOOST_PARAMETER_MAX_ARITY is a user-definable macro used by Boost.Parameter. boost/signals2/signal_type.hpp needs it to be at least 7, but will only set it to 7 if it hasn't already been defined by the user or by an earlier include of the Boost.Parameter headers (which is probably done by the Accumulators library). So you need to either define BOOST_PARAMETER_MAX_ARITY to 7 or more (preferably as a compiler option so it is done before any includes), or take some care to either not include signal_type.hpp or make sure it gets included before boost/parameter/config.hpp (which will default define the macro to 5). -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk3wyKkACgkQ5vihyNWuA4WfNgCdFm3mv28EMx9++gygo+mf9Hpk 3TEAoMQdym77t/Ps9Iuc17ZibMlBPJpE =6Pgi -----END PGP SIGNATURE-----

On Thu, Jun 9, 2011 at 3:20 PM, Frank Mori Hess <frank.hess@nist.gov> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Thursday, June 09, 2011, sguazt wrote:
I get the following errors: --- [error] --- In file included from ./boost-trunk/boost/signals2.hpp:20:0, from boost_signals2_accumulators.cpp:4: ./boost-trunk/boost/signals2/signal_type.hpp:29:2: error: #error This header requires BOOST_PARAMETER_MAX_ARITY to be defined as 7 or greater prior to including Boost.Parameter headers
BOOST_PARAMETER_MAX_ARITY is a user-definable macro used by Boost.Parameter. boost/signals2/signal_type.hpp needs it to be at least 7, but will only set it to 7 if it hasn't already been defined by the user or by an earlier include of the Boost.Parameter headers (which is probably done by the Accumulators library). So you need to either define BOOST_PARAMETER_MAX_ARITY to 7 or more (preferably as a compiler option so it is done before any includes), or take some care to either not include signal_type.hpp or make sure it gets included before boost/parameter/config.hpp (which will default define the macro to 5).
Gordon and Frank, Thank you very much for your quick reply. Indeed, setting BOOST_PARAMETER_MAX_ARITY to 7 seems to fix. Hope this "design issue" (?!?) will be fixed later... From the macro name, it seems something related to the emulation of C++0x variable template parameters. Thank you very much! Best, -- Marco
participants (3)
-
Frank Mori Hess
-
Gordon Woodhull
-
sguazt