Boost logo

Boost Users :

Subject: Re: [Boost-users] [Accumulators] Errors compiling the "Hello, World!" example
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2010-01-11 06:45:31


On Mon, Jan 11, 2010 at 11:37 AM, Eric Niebler <eric_at_[hidden]> wrote:
> 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<int T2, class Arg1, class A0, class A1, class
>> A2, class A3, class A4, class A5, class A6, class A7, class A8, class
>> A9, class A10, class A11, class A12, class A13, class A14>  typename
>> boost::accumulators::detail::extractor_result<Arg1,
>> boost::accumulators::tag::moment<T2>  >::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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net