Boost logo

Boost Users :

Subject: Re: [Boost-users] [property_tree] Compilation Problem when #including <boost/property_tree/json_parser.hpp>
From: Edward Diener (eldiener_at_[hidden])
Date: 2014-02-10 10:47:10


On 2/10/2014 5:29 AM, Adi Shavit wrote:
> Hi,
>
> On VS2010, the following code does not compile if I restore the
> commented out#include:
>
> *// #include <boost/property_tree/json_parser.hpp>*
>
> struct X
> {
> enum Labels { ERROR, ONE, TWO, THREE };
> // problem => ^^^^^
> };
>
> void f()
> {
> X::Labels r = X::ERROR;
> // problem => ^^^^^
> }
>
> The VS2010 errors are:
>
> t.cpp(5): error C2059: syntax error : 'constant'
> t.cpp(5): error C2143: syntax error : missing ';' before '}'
> t.cpp(5): error C2238: unexpected token(s) preceding ';'
> t.cpp(7): error C2059: syntax error : '}'
> t.cpp(7): error C2143: syntax error : missing ';' before '}'
> t.cpp(7): error C2059: syntax error : '}'
> t.cpp(11): error C2589: 'constant' : illegal token on right side of '::'
> t.cpp(11): error C2059: syntax error : '::'
>
>
> It seems that somewhere inside the #include hierarchy the symbol ERROR
> is #defined to cause this code to fail.
> Renaming ERROR to something else avoids this problem.

I do not know where ERROR is occuring. But it is certainly not a good
idea to have an enumeration name be a common all-uppercase name.

>
> I think I tracked it into
> 'boost/spirit/home/classic/iterator/impl/file_iterator.ipp' but I'm not
> sure where exactly it is coming from.


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