Boost C++ Libraries: Ticket #8181: Accumulator : compilation error due to average function https://svn.boost.org/trac10/ticket/8181 <p> Hello, I'm trying to use accumulators to compute the mean of a set of double. Firstly, I instantiate an accumulator_set object using the correct tag, as following : </p> <pre class="wiki">#include &lt;boost/accumulators/accumulators.hpp&gt; #include &lt;boost/accumulators/statistics.hpp&gt; typedef boost::accumulators::accumulator_set&lt;double, boost::accumulators::stats&lt; boost::accumulators::tag::mean &gt; &gt; accumulator_type; accumulator_type acc; </pre><p> I try to compile this code with clang and with gcc(4.6), and both of them give the same kind of error : </p> <p> With clang : /usr/include/boost/accumulators/statistics/mean.hpp:42:48: error: too many arguments provided to function-like macro invocation return numeric::average(sum(args), count(args)); </p> <p> With gcc : /usr/include/boost/accumulators/statistics/mean.hpp:42:59: error: macro "average" passed 2 arguments, but takes just 1 </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8181 Trac 1.4.3 Marshall Clow Tue, 26 Feb 2013 14:40:04 GMT description changed https://svn.boost.org/trac10/ticket/8181#comment:1 https://svn.boost.org/trac10/ticket/8181#comment:1 <ul> <li><strong>description</strong> modified (<a href="/trac10/ticket/8181?action=diff&amp;version=1">diff</a>) </li> </ul> <p> (Description edited to make the code more obvious) </p> <p> I tried compiling your code with gcc 4.2.1 and clang, and both compiled it correctly. </p> <p> I suspect that you need to post more code. </p> Ticket Steven Watanabe Tue, 26 Feb 2013 15:11:33 GMT <link>https://svn.boost.org/trac10/ticket/8181#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8181#comment:2</guid> <description> <p> It's clear that average is defined as a macro. Nothing in Boost does this. Therefore, the source of the problem is some other header. Defining macros like this is wrong. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Tue, 26 Feb 2013 17:45:14 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8181#comment:3 https://svn.boost.org/trac10/ticket/8181#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">worksforme</span> </li> </ul> <p> Agreed. No repro. Likely caused by a rougue <code>average</code> macro. </p> Ticket