Boost::Polygon issue with including in project
I'm having an issue trying to use Boost::Polygon, I've added boost/polygon/polygon.hpp but when I try to compile I get: boost/polygon/transform.hpp:147: error: expected identifier before numeric constant boost/polygon/transform.hpp:147: error: expected `}' before numeric constant boost/polygon/transform.hpp:147: error: expected unqualified-id before numeric constant boost/polygon/transform.hpp:219: error: expected unqualified-id before ')' token boost/polygon/transform.hpp:220: error: expected `)' before 'atr' boost/polygon/transform.hpp:221: error: expected unqualified-id before 'const' boost/polygon/transform.hpp:221: error: expected `)' before 'const' boost/polygon/transform.hpp:222: error: expected unqualified-id before 'const' boost/polygon/transform.hpp:222: error: expected `)' before 'const' boost/polygon/transform.hpp:223: error: expected unqualified-id before 'const' boost/polygon/transform.hpp:223: error: expected `)' before 'const' boost/polygon/transform.hpp:224: error: expected unqualified-id before 'const' boost/polygon/transform.hpp:224: error: expected `)' before 'const' boost/polygon/transform.hpp:225: error: expected unqualified-id before 'const' boost/polygon/transform.hpp:225: error: expected `)' before 'const' boost/polygon/transform.hpp:228: error: 'boost::polygon::axis_transformation& boost::polygon::operator=(const boost::polygon::axis_transformation&)' must be a nonstatic member function boost/polygon/transform.hpp:231: error: expected ',' or '...' before '&' token boost/polygon/transform.hpp:231: error: 'boost::polygon::axis_transformation& boost::polygon::operator=(int)' must be a nonstatic member function boost/polygon/transform.hpp:234: error: non-member function 'bool boost::polygon::operator==(const boost::polygon::axis_transformation&)' cannot have cv-qualifier boost/polygon/transform.hpp:234: error: 'bool boost::polygon::operator==(const boost::polygon::axis_transformation&)' must take exactly two arguments boost/polygon/transform.hpp:237: error: non-member function 'bool boost::polygon::operator!=(const boost::polygon::axis_transformation&)' cannot have cv-qualifier boost/polygon/transform.hpp:237: error: 'bool boost::polygon::operator!=(const boost::polygon::axis_transformation&)' must take exactly two arguments boost/polygon/transform.hpp:240: error: non-member function 'bool boost::polygon::operator<(const boost::polygon::axis_transformation&)' cannot have cv-qualifier boost/polygon/transform.hpp:240: error: 'bool boost::polygon::operator<(const boost::polygon::axis_transformation&)' must take exactly two arguments 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 boost/polygon/transform.hpp:246: error: 'boost::polygon::axis_transformation& boost::polygon::operator+=(const boost::polygon::axis_transformation&)' must take exactly two arguments boost/polygon/transform.hpp:250: error: non-member function 'void boost::polygon::populate_axis_array(boost::polygon::INDIVIDUAL_AXIS*)' cannot have cv-qualifier 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 boost/polygon/transform.hpp: In function 'void boost::polygon::get_directions(boost::polygon::direction_2d&, boost::polygon::direction_2d&)': ........etc ....... Thanks Chris
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 ________________________________ From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Chris Stylianou Sent: Wednesday, March 23, 2011 3:49 AM To: boost-users@lists.boost.org Subject: [Boost-users] Boost::Polygon issue with including in project I'm having an issue trying to use Boost::Polygon, I've added boost/polygon/polygon.hpp but when I try to compile I get: boost/polygon/transform.hpp:147: error: expected identifier before numeric constant boost/polygon/transform.hpp:147: error: expected `}' before numeric constant boost/polygon/transform.hpp:147: error: expected unqualified-id before numeric constant boost/polygon/transform.hpp:219: error: expected unqualified-id before ')' token boost/polygon/transform.hpp:220: error: expected `)' before 'atr' boost/polygon/transform.hpp:221: error: expected unqualified-id before 'const' boost/polygon/transform.hpp:221: error: expected `)' before 'const' boost/polygon/transform.hpp:222: error: expected unqualified-id before 'const' boost/polygon/transform.hpp:222: error: expected `)' before 'const' boost/polygon/transform.hpp:223: error: expected unqualified-id before 'const' boost/polygon/transform.hpp:223: error: expected `)' before 'const' boost/polygon/transform.hpp:224: error: expected unqualified-id before 'const' boost/polygon/transform.hpp:224: error: expected `)' before 'const' boost/polygon/transform.hpp:225: error: expected unqualified-id before 'const' boost/polygon/transform.hpp:225: error: expected `)' before 'const' boost/polygon/transform.hpp:228: error: 'boost::polygon::axis_transformation& boost::polygon::operator=(const boost::polygon::axis_transformation&)' must be a nonstatic member function boost/polygon/transform.hpp:231: error: expected ',' or '...' before '&' token boost/polygon/transform.hpp:231: error: 'boost::polygon::axis_transformation& boost::polygon::operator=(int)' must be a nonstatic member function boost/polygon/transform.hpp:234: error: non-member function 'bool boost::polygon::operator==(const boost::polygon::axis_transformation&)' cannot have cv-qualifier boost/polygon/transform.hpp:234: error: 'bool boost::polygon::operator==(const boost::polygon::axis_transformation&)' must take exactly two arguments boost/polygon/transform.hpp:237: error: non-member function 'bool boost::polygon::operator!=(const boost::polygon::axis_transformation&)' cannot have cv-qualifier boost/polygon/transform.hpp:237: error: 'bool boost::polygon::operator!=(const boost::polygon::axis_transformation&)' must take exactly two arguments boost/polygon/transform.hpp:240: error: non-member function 'bool boost::polygon::operator<(const boost::polygon::axis_transformation&)' cannot have cv-qualifier boost/polygon/transform.hpp:240: error: 'bool boost::polygon::operator<(const boost::polygon::axis_transformation&)' must take exactly two arguments 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 boost/polygon/transform.hpp:246: error: 'boost::polygon::axis_transformation& boost::polygon::operator+=(const boost::polygon::axis_transformation&)' must take exactly two arguments boost/polygon/transform.hpp:250: error: non-member function 'void boost::polygon::populate_axis_array(boost::polygon::INDIVIDUAL_AXIS*)' cannot have cv-qualifier 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 boost/polygon/transform.hpp: In function 'void boost::polygon::get_directions(boost::polygon::direction_2d&, boost::polygon::direction_2d&)': ........etc ....... Thanks Chris
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
..../include/boost/polygon/transform.hpp:147: error: expected `}' before numeric constant
..../include/boost/polygon/transform.hpp:147: error: expected unqualified-id before numeric constant
..../include/boost/polygon/transform.hpp:219: error: expected unqualified-id before ')' token
..../include/boost/polygon/transform.hpp:220: error: expected `)' before 'atr'
..../include/boost/polygon/transform.hpp:221: error: expected unqualified-id before 'const'
..../include/boost/polygon/transform.hpp:221: error: expected `)' before 'const'
..../include/boost/polygon/transform.hpp:222: error: expected unqualified-id before 'const'
..../include/boost/polygon/transform.hpp:222: error: expected `)' before 'const'
..../include/boost/polygon/transform.hpp:223: error: expected unqualified-id before 'const'
..../include/boost/polygon/transform.hpp:223: error: expected `)' before 'const'
..../include/boost/polygon/transform.hpp:224: error: expected unqualified-id before 'const'
..../include/boost/polygon/transform.hpp:224: error: expected `)' before 'const'
..../include/boost/polygon/transform.hpp:225: error: expected unqualified-id before 'const'
..../include/boost/polygon/transform.hpp:225: error: expected `)' before 'const'
..../include/boost/polygon/transform.hpp:228: error: 'boost::polygon::axis_transformation& boost::polygon::operator=(const boost::polygon::axis_transformation&)' must be a nonstatic member function
..../include/boost/polygon/transform.hpp:231: error: expected ',' or '...' before '&' token
..../include/boost/polygon/transform.hpp:231: error: 'boost::polygon::axis_transformation& boost::polygon::operator=(int)' must be a nonstatic member function
..../include/boost/polygon/transform.hpp:234: error: non-member function 'bool boost::polygon::operator==(const boost::polygon::axis_transformation&)' cannot have cv-qualifier
..../include/boost/polygon/transform.hpp:234: error: 'bool boost::polygon::operator==(const boost::polygon::axis_transformation&)' must take exactly two arguments
..../include/boost/polygon/transform.hpp:237: error: non-member function 'bool boost::polygon::operator!=(const boost::polygon::axis_transformation&)' cannot have cv-qualifier
..../include/boost/polygon/transform.hpp:237: error: 'bool boost::polygon::operator!=(const boost::polygon::axis_transformation&)' must take exactly two arguments
..../include/boost/polygon/transform.hpp:240: error: non-member function 'bool boost::polygon::operator<(const boost::polygon::axis_transformation&)' cannot have cv-qualifier
..../include/boost/polygon/transform.hpp:240: error: 'bool boost::polygon::operator<(const boost::polygon::axis_transformation&)' must take exactly two arguments
..../include/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
..../include/boost/polygon/transform.hpp:246: error: 'boost::polygon::axis_transformation& boost::polygon::operator+=(const boost::polygon::axis_transformation&)' must take exactly two arguments
..../include/boost/polygon/transform.hpp:250: error: non-member function 'void boost::polygon::populate_axis_array(boost::polygon::INDIVIDUAL_AXIS*)' cannot have cv-qualifier
..../include/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
..../include/boost/polygon/transform.hpp: In function 'void boost::polygon::get_directions(boost::polygon::direction_2d&, boost::polygon::direction_2d&)':
..../include/boost/polygon/transform.hpp:256: error: 'atr_' was not declared in this scope
..../include/boost/polygon/transform.hpp: At global scope:
..../include/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
..../include/boost/polygon/transform.hpp: In function 'void boost::polygon::get_directions(boost::polygon::direction_3d&, boost::polygon::direction_3d&, boost::polygon::direction_3d&)':
..../include/boost/polygon/transform.hpp:268: error: 'atr_' was not declared in this scope
..../include/boost/polygon/transform.hpp: At global scope:
..../include/boost/polygon/transform.hpp:307: error: non-member function 'void boost::polygon::transform(coordinate_type&, coordinate_type&)' cannot have cv-qualifier
..../include/boost/polygon/transform.hpp:311: error: non-member function 'void boost::polygon::transform(coordinate_type&, coordinate_type&, coordinate_type&)' cannot have cv-qualifier
..../include/boost/polygon/transform.hpp:317: error: non-member function 'boost::polygon::axis_transformation boost::polygon::inverse_2d()' cannot have cv-qualifier
..../include/boost/polygon/transform.hpp:323: error: non-member function 'boost::polygon::axis_transformation boost::polygon::inverse()' cannot have cv-qualifier
..../include/boost/polygon/transform.hpp:328: error: expected unqualified-id before 'private'
..../include/boost/polygon/transform.hpp:371: error: 'orientation_3d' has not been declared
..../include/boost/polygon/transform.hpp:372: error: 'orientation_2d' has not been declared
..../include/boost/polygon/transform.hpp:372: error: 'scale_factor_type boost::anisotropic_scale_factor
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:714404515@24032011-0A39] 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
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
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
Please see below my colleague response. From: Tom Wiggins Sent: 28 March 2011 10:25 To: Chris Stylianou Subject: Boost debugging Hi Chris, I tried running the same build command with the "g++ -E" option. The error line gets turned into: ESU = 2, EAST_SOUTH_UP = 2, 2 = 2, EAST_SOUTH = 2, FLIP_Y = 2, Obviously ES is being defined to 2 from somewhere else. The error does not get fixed if we #undef ES before the #include of "polygon.hpp" in the "main.cc" file, but it does if we insert an #undef directly before the declaration of the enum in "polygon.hpp" itself. (with no other errors reported) On further inspection (and checking the GCC debug output options) it looks like that it is being defined in "/usr/include/sys/regset.h" 77 /* 78 * The names and offsets defined here are specified by i386 ABI suppl. 79 */ 80 81 #define SS 18 /* only stored on a privilege transition */ 82 #define UESP 17 /* only stored on a privilege transition */ 83 #define EFL 16 84 #define CS 15 85 #define EIP 14 86 #define ERR 13 87 #define TRAPNO 12 88 #define EAX 11 89 #define ECX 10 90 #define EDX 9 91 #define EBX 8 92 #define ESP 7 93 #define EBP 6 94 #define ESI 5 95 #define EDI 4 96 #define DS 3 97 #define ES 2 98 #define FS 1 99 #define GS 0 Kind regards, Tom
participants (2)
-
Chris Stylianou
-
Simonson, Lucanus J