Chris,
I just noticed that your OS is solaris2.10.
It compiles for me with gcc and icc in linux, it compiles for windows with MSVC 7.1, 8 and 9 and it compiles for clang. I don't have access to solaris OS running on x86 to test. We have no solaris target platforms in the boost trunk or release regressions.
Why don't you try looking at the intermediate file generated after the C pre-processor runs to see if something on line 147 got expanded. That is the only possible thing it could be. It makes no sense for the first error to be on line 147 becaues 146 does the exact same thing but with different names for enum values. One thing you can do is try
#ifdef ESU
#undefine ESU
#endif
#ifdef ES
#undefine ES
#endif
#ifdef EAST_SOUTH_UP
#undefine EAST_SOUTH_UP
#endif
#ifdef FLIP_Y
#undefine FLIP_Y
#endif
#ifdef EAST_SOUTH
#undefine EAST_SOUTH
#endif
before you include polygon.hpp.
If that doesn't work you can try commenting out the include of transform.hpp in polygon.hpp. Because the code that uses it is generic I don't think I depend on it directly in any other files. The user can specify their own transform object type and pass it into my functions that accept a transform as long as they conform to the interface of my transform types.
Thanks,
Luke
________________________________
From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Chris Stylianou
Sent: Friday, March 25, 2011 3:27 AM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] Boost::Polygon issue with including in project
Luke, I've tried moving Polygon.hpp to the top but no difference in the error. Below is a test program created that shows the same issue with no other includes other than Polygon.hpp
Main.cc
#include
int main(int argc, char** argv)
{
exit(0);
}
Compile command
g++ -I/path/to/boost/ -c main.cc
GCC information
Target: i386-pc-solaris2.10
gcc version 4.2.1
Errors:
In file included from /path/to/boost/polygon/polygon.hpp:24,
from main.cc:1:
/path/to/boost/polygon/transform.hpp:147: error: expected identifier before numeric constant
/path/to/boost/polygon/transform.hpp:147: error: expected `}' before numeric constant
/path/to/boost/polygon/transform.hpp:147: error: expected unqualified-id before numeric constant
/path/to/boost/polygon/transform.hpp:219: error: expected unqualified-id before ')' token
/path/to/boost/polygon/transform.hpp:220: error: expected `)' before 'atr'
/path/to/boost/polygon/transform.hpp:221: error: expected unqualified-id before 'const'
/path/to/boost/polygon/transform.hpp:221: error: expected `)' before 'const'
/path/to/boost/polygon/transform.hpp:222: error: expected unqualified-id before 'const'
/path/to/boost/polygon/transform.hpp:222: error: expected `)' before 'const'
/path/to/boost/polygon/transform.hpp:223: error: expected unqualified-id before 'const'
/path/to/boost/polygon/transform.hpp:223: error: expected `)' before 'const'
/path/to/boost/polygon/transform.hpp:224: error: expected unqualified-id before 'const'
/path/to/boost/polygon/transform.hpp:224: error: expected `)' before 'const'
/path/to/boost/polygon/transform.hpp:225: error: expected unqualified-id before 'const'
/path/to/boost/polygon/transform.hpp:225: error: expected `)' before 'const'
/path/to/boost/polygon/transform.hpp:228: error: 'boost::polygon::axis_transformation& boost::polygon::operator=(const boost::polygon::axis_transformation&)' must be a nonstatic member function
/path/to/boost/polygon/transform.hpp:231: error: expected ',' or '...' before '&' token
/path/to/boost/polygon/transform.hpp:231: error: ISO C++ forbids declaration of 'ATR' with no type
/path/to/boost/polygon/transform.hpp:231: error: 'boost::polygon::axis_transformation& boost::polygon::operator=(int)' must be a nonstatic member function
/path/to/boost/polygon/transform.hpp:234: error: non-member function 'bool boost::polygon::operator==(const boost::polygon::axis_transformation&)' cannot have cv-qualifier
/path/to/boost/polygon/transform.hpp:234: error: 'bool boost::polygon::operator==(const boost::polygon::axis_transformation&)' must take exactly two arguments
/path/to/boost/polygon/transform.hpp:237: error: non-member function 'bool boost::polygon::operator!=(const boost::polygon::axis_transformation&)' cannot have cv-qualifier
/path/to/boost/polygon/transform.hpp:237: error: 'bool boost::polygon::operator!=(const boost::polygon::axis_transformation&)' must take exactly two arguments
/path/to/boost/polygon/transform.hpp:240: error: non-member function 'bool boost::polygon::operator<(const boost::polygon::axis_transformation&)' cannot have cv-qualifier
/path/to/boost/polygon/transform.hpp:240: error: 'bool boost::polygon::operator<(const boost::polygon::axis_transformation&)' must take exactly two arguments
/path/to/boost/polygon/transform.hpp:243: error: non-member function 'boost::polygon::axis_transformation boost::polygon::operator+(const boost::polygon::axis_transformation&)' cannot have cv-qualifier
/path/to/boost/polygon/transform.hpp:246: error: 'boost::polygon::axis_transformation& boost::polygon::operator+=(const boost::polygon::axis_transformation&)' must take exactly two arguments
/path/to/boost/polygon/transform.hpp:250: error: non-member function 'void boost::polygon::populate_axis_array(boost::polygon::INDIVIDUAL_AXIS*)' cannot have cv-qualifier
/path/to/boost/polygon/transform.hpp:255: error: non-member function 'void boost::polygon::get_directions(boost::polygon::direction_2d&, boost::polygon::direction_2d&)' cannot have cv-qualifier
/path/to/boost/polygon/transform.hpp: In function 'void boost::polygon::get_directions(boost::polygon::direction_2d&, boost::polygon::direction_2d&)':
/path/to/boost/polygon/transform.hpp:256: error: 'atr_' was not declared in this scope
/path/to/boost/polygon/transform.hpp: At global scope:
/path/to/boost/polygon/transform.hpp:267: error: non-member function 'void boost::polygon::get_directions(boost::polygon::direction_3d&, boost::polygon::direction_3d&, boost::polygon::direction_3d&)' cannot have cv-qualifier
/path/to/boost/polygon/transform.hpp: In function 'void boost::polygon::get_directions(boost::polygon::direction_3d&, boost::polygon::direction_3d&, boost::polygon::direction_3d&)':
/path/to/boost/polygon/transform.hpp:268: error: 'atr_' was not declared in this scope
/path/to/boost/polygon/transform.hpp: At global scope:
/path/to/boost/polygon/transform.hpp:307: error: non-member function 'void boost::polygon::transform(coordinate_type&, coordinate_type&)' cannot have cv-qualifier
/path/to/boost/polygon/transform.hpp:311: error: non-member function 'void boost::polygon::transform(coordinate_type&, coordinate_type&, coordinate_type&)' cannot have cv-qualifier
/path/to/boost/polygon/transform.hpp:317: error: non-member function 'boost::polygon::axis_transformation boost::polygon::inverse_2d()' cannot have cv-qualifier
/path/to/boost/polygon/transform.hpp:323: error: non-member function 'boost::polygon::axis_transformation boost::polygon::inverse()' cannot have cv-qualifier
/path/to/boost/polygon/transform.hpp:328: error: expected unqualified-id before 'private'
/path/to/boost/polygon/transform.hpp:371: error: 'orientation_3d' has not been declared
/path/to/boost/polygon/transform.hpp:372: error: 'orientation_2d' has not been declared
/path/to/boost/polygon/transform.hpp:375: error: 'orientation_3d' has not been declared
/path/to/boost/polygon/transform.hpp:376: error: 'orientation_2d' has not been declared
/path/to/boost/polygon/transform.hpp:392: error: expected ';' before '(' token
/path/to/boost/polygon/transform.hpp: In member function 'scale_factor_type boost::anisotropic_scale_factor::get(int) const':
/path/to/boost/polygon/transform.hpp:372: error: there are no arguments to 'orientation_3d' that depend on a template parameter, so a declaration of 'orientation_3d' must be available
/path/to/boost/polygon/transform.hpp:372: error: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/path/to/boost/polygon/transform.hpp: In member function 'void boost::anisotropic_scale_factor::set(int, scale_factor_type)':
/path/to/boost/polygon/transform.hpp:376: error: there are no arguments to 'orientation_3d' that depend on a template parameter, so a declaration of 'orientation_3d' must be available
/path/to/boost/polygon/transform.hpp: At global scope:
/path/to/boost/polygon/transform.hpp:421: error: expected `)' before 'atr'
/path/to/boost/polygon/transform.hpp:422: error: 'axis_transformation' has not been declared
/path/to/boost/polygon/transform.hpp:422: error: expected `)' before 'atr'
/path/to/boost/polygon/transform.hpp:426: error: expected `)' before 'atr'
/path/to/boost/polygon/transform.hpp:428: error: expected `)' before 'atr'
/path/to/boost/polygon/transform.hpp:447: error: 'axis_transformation' does not name a type
/path/to/boost/polygon/transform.hpp:450: error: expected ',' or '...' before '&' token
/path/to/boost/polygon/transform.hpp:450: error: ISO C++ forbids declaration of 'axis_transformation' with no type
/path/to/boost/polygon/transform.hpp:472: error: 'direction_2d' has not been declared
/path/to/boost/polygon/transform.hpp:473: error: 'direction_2d' has not been declared
/path/to/boost/polygon/transform.hpp:476: error: 'direction_3d' has not been declared
/path/to/boost/polygon/transform.hpp:477: error: 'direction_3d' has not been declared
/path/to/boost/polygon/transform.hpp:478: error: 'direction_3d' has not been declared
/path/to/boost/polygon/transform.hpp:482: error: 'axis_transformation' does not name a type
/path/to/boost/polygon/transform.hpp:483: error: ISO C++ forbids declaration of 'point_3d_data' with no type
/path/to/boost/polygon/transform.hpp:483: error: expected ';' before '<' token
/path/to/boost/polygon/transform.hpp:486: error: 'axis_transformation' was not declared in this scope
/path/to/boost/polygon/transform.hpp:486: error: expected primary-expression before 'p'
/path/to/boost/polygon/transform.hpp:486: error: 'point_concept' was not declared in this scope
/path/to/boost/polygon/transform.hpp:486: error: variable or field 'construct_dispatch' declared void
/path/to/boost/polygon/transform.hpp:488: error: 'axis_transformation' was not declared in this scope
/path/to/boost/polygon/transform.hpp:488: error: expected primary-expression before 'p'
/path/to/boost/polygon/transform.hpp:488: error: 'point_3d_concept' was not declared in this scope
/path/to/boost/polygon/transform.hpp:488: error: variable or field 'construct_dispatch' declared void
/path/to/boost/polygon/transform.hpp:490: error: 'axis_transformation' was not declared in this scope
/path/to/boost/polygon/transform.hpp:490: error: expected primary-expression before 'rp'
/path/to/boost/polygon/transform.hpp:490: error: expected primary-expression before 'dp'
/path/to/boost/polygon/transform.hpp:490: error: 'point_concept' was not declared in this scope
/path/to/boost/polygon/transform.hpp:490: error: variable or field 'construct_dispatch' declared void
/path/to/boost/polygon/transform.hpp:492: error: 'axis_transformation' was not declared in this scope
/path/to/boost/polygon/transform.hpp:492: error: expected primary-expression before 'rp'
/path/to/boost/polygon/transform.hpp:492: error: expected primary-expression before 'dp'
/path/to/boost/polygon/transform.hpp:492: error: 'point_3d_concept' was not declared in this scope
/path/to/boost/polygon/transform.hpp:492: error: variable or field 'construct_dispatch' declared void
/path/to/boost/polygon/transform.hpp: In member function 'void boost::transformation::get_directions(int&, int&) const':
/path/to/boost/polygon/transform.hpp:474: error: 'atr_' was not declared in this scope
/path/to/boost/polygon/transform.hpp: In member function 'void boost::transformation::get_directions(int&, int&, int&) const':
/path/to/boost/polygon/transform.hpp:479: error: 'atr_' was not declared in this scope
/path/to/boost/polygon/transform.hpp: At global scope:
/path/to/boost/polygon/transform.hpp:498: error: expected declaration before '}' token
Thanks
Chris Stylianou
From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Simonson, Lucanus J
Sent: 24 March 2011 15:51
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] Boost::Polygon issue with including in project
Chris,
Line 147 of transform.hpp is as follows:
ESU = 2, EAST_SOUTH_UP = 2, ES = 2, EAST_SOUTH = 2, FLIP_Y = 2,
These are enum value definitions. I suspect that what is happening is that ESU, or more likely ES is a defined macro in some header file included before Polygon.hpp. After the expansion of that macro the code no longer makes sense.
I suggest including the Polygon.hpp first since it doesn't depend on any other code. If you include polygon.hpp in a header file be sure that header file gets included before others that might define macros that conflict with names used by the library.
Regards,
Luke
________________________________
From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Chris Stylianou
Sent: Thursday, March 24, 2011 3:30 AM
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] Boost::Polygon issue with including in project
Hi Luke, here is the whole list. We are using gcc 4.3.3 with Boost 1.45.0, but it has also been tested with 1.46.1 with the same error output.
In file included from ..../include/boost/polygon/polygon.hpp:24,
from accessors/shapes/Polygon.h:18,
from accessors/shapes/Polygon.cc:8:
..../include/boost/polygon/transform.hpp:147: error: expected identifier before numeric constant
...
Thanks
Chris Stylianou
_______________________________________________________________
borwell
[cid:304232617@25032011-0AB0]
Malvern Hills Science Park
Geraldine Road
Malvern
England
WR14 3SZ
t: +44 (0)1684 585240
e: chris@borwell.commailto:chris@borwell.com
w: www.borwell.com
"Making IT work for you"
P Please consider the environment before printing this email
_______________________________________________________________
From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Simonson, Lucanus J
Sent: 23 March 2011 16:03
To: boost-users@lists.boost.org
Subject: Re: [Boost-users] Boost::Polygon issue with including in project
Is line 147 of transform.hpp your first syntax error? Can you attach the complete listing of syntax errors generated as well as the compiler you are using? Also, which version of boost are you using?
Thanks,
Luke