Boost C++ Libraries: Ticket #9132: mpl and lexical_cast dependency https://svn.boost.org/trac10/ticket/9132 <p> Hi, </p> <p> It took mi one day to find out why my msm stopped to compile after upgrading to new boost. I was upgrading from 1.45 (with msm from 1.51) to 1.53. After many tries with different #define's it turned out the problem is elsewhere. This is code that breaks compilation: </p> <pre class="wiki">#include &lt;boost/lexical_cast.hpp&gt; #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS #define BOOST_MPL_LIMIT_VECTOR_SIZE 30 #include &lt;boost/mpl/vector.hpp&gt; int main() { boost::mpl::vector&lt;int, char, double, int, int, int, int, int, int, char, int, char, double, int, int, int, int, int, int, char, int&gt; v; } </pre><p> and compilation output: </p> <pre class="wiki">g++ -Wall -Wextra -pedantic -Wlong-long plik.C -o plik -O2 -I /bldtools/3rd/boost/boost1.53/32bitrhel63/include -Wno-unused plik.C:13:1: warning: "BOOST_MPL_LIMIT_VECTOR_SIZE" redefined In file included from /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/mpl/vector.hpp:18, from /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/math/policies/policy.hpp:14, from /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/math/special_functions/math_fwd.hpp:28, from /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/math/special_functions/sign.hpp:17, from /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/lexical_cast.hpp:167, from plik.C:10: /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/mpl/limits/vector.hpp:18:1: warning: this is the location of the previous definition plik.C: In function âint main()â: plik.C:41: error: wrong number of template arguments (21, should be 20) /bldtools/3rd/boost/boost1.53/32bitrhel63/include/boost/mpl/aux_/preprocessed/gcc/vector.hpp:22: error: provided for âtemplate&lt;class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10, class T11, class T12, class T13, class T14, class T15, class T16, class T17, class T18, class T19&gt; struct boost::mpl::vectorâ plik.C:41: error: invalid type in declaration before â;â token make: *** [plik] Error 1 </pre><p> Removing lexical_cast fixes the problem. Looks like lexical_cast started to use mpl vector with default settings and later #define's don't change the settings. </p> <p> The issue is complicated because it is not enough to move #define's at the beginning of file. I had to modify all my *.hpp files to include msm headers (and #define's) at the beginning of file. And also *.cpp files to include the above *.hpp at the beginning of file :(. </p> <p> Regards, </p> <p> Marcin Pytel </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9132 Trac 1.4.3 anonymous Thu, 19 Sep 2013 10:41:23 GMT version changed https://svn.boost.org/trac10/ticket/9132#comment:1 https://svn.boost.org/trac10/ticket/9132#comment:1 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.54.0</span> → <span class="trac-field-new">Boost 1.53.0</span> </li> </ul> Ticket