
Hello all, I am trying to compile the example below on MSVC using Boost.Chrono (headers-only) from the sandbox but I am getting some compiler errors. What am I doing wrong? Thank you very much. --Lorenzo #define BOOST_CHRONO_INLINED #include <boost/chrono.hpp> #include <boost/spirit/include/phoenix.hpp> #include #include #include #include #include int main(int argc, char* argv[]) { assert(argc == 2); unsigned long n = sqrt(double(atol(argv[1]))); using boost::phoenix::ref; using boost::phoenix::arg_names::_1; double sum = 0.0; int factor = 1; std::vector v(n); std::fill(v.begin(), v.end(), 1.0); boost::chrono::duration sec; for (unsigned long i = 0; i < n; ++i) { boost::chrono::system_clock::time_point start = boost::chrono::system_clock::now(); std::for_each(v.begin(), v.end(), ( ref(sum) += factor * _1 )); sec += boost::chrono::system_clock::now() - start; } std::cout << sec.count() << std::endl; assert(sum == n * n); return 0; } E:\sandbox\boost-sandbox-local\libs\local\example>cl /EHs /Ox /I..\..\.. /I"c:\P rogram Files\boost\boost_1_46_1" /I..\..\..\..\boost-sandbox-chrono.x benchmark_ boost_phoenix.cpp Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved. benchmark_boost_phoenix.cpp ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(72) : error C2143: syntax e rror : missing ',' before ')' ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(75) : see reference to class template instantiation 'boost::mpl::abs_impl::apply' being compiled ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(72) : error C2059: syntax e rror : ')' ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(74) : error C2143: syntax e rror : missing ';' before '{' ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(75) : error C2143: syntax e rror : missing ';' before '}' ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(72) : error C2143: syntax e rror : missing ';' before '}' ..\..\..\..\boost-sandbox-chrono.x\boost/mpl/abs.hpp(72) : fatal error C1004: un expected end-of-file found -- View this message in context: http://boost.2283326.n4.nabble.com/boost-chrono-Compiler-errors-for-mpl-abs-... Sent from the Boost - Dev mailing list archive at Nabble.com.