On Mon, Jan 11, 2010 at 11:37 AM, Eric Niebler
On 1/11/2010 10:05 AM, Marco Guazzone wrote:
Hello!
I'm new to Accumulators. I've tried to compile the "Hello, World!" example (found in the User Guide) but it fails:
--- [error] --- $ g++ -ansi -Wall -o accumulators_test1 accumulators_test1.cpp
/usr/include//boost/accumulators/statistics_fwd.hpp: In function ‘int main()’: /usr/include//boost/accumulators/statistics_fwd.hpp:87: error: ‘template<int N> struct boost::accumulators::tag::moment’ is not a function, /usr/include//boost/accumulators/statistics/moment.hpp:104: error: conflict with ‘template
typename boost::accumulators::detail::extractor_result ::type boost::accumulators::extract::moment(const Arg1&, const A0&, const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&, const A11&, const A12&, const A13&, const A14&)’ accumulators_test1.cpp:22: error: in call to ‘moment’ --- [/error] --- <snip>
Where I am wrong?
Marco,
You are not wrong. With my hello world example, I have inadvertently led you into the murky waters of C++ name look-up. GCC does it one way, the rest of the world does it another, and you are caught in the fray. If you qualify the call to moment (accumulators::moment<2>(acc)), the problem will go away.
Thank you Eric! Just for info, in my case, to fix the problem, I had to use fully qualification: boost::accumulators::moment<2>(acc) instead of accumulators::moment<2>(acc)
I'll fix the docs for 1.42 and see if there's something can be done in the library to obviate the need for qualification in the future.
Sorry for the trouble,
No problem :) Best, -- Marco