[geos-devel] Ready for 2.1.2 ?

Carlos A. Rueda carueda at ucdavis.edu
Tue Jun 14 14:37:35 EDT 2005

strk at refractions.net wrote:
 > Yes, thanks, but I'd like to avoid including the "other" Polygon
 > definition instead, how is it being imported ? Does your compiler
 > tell you that ? Is it in the std namespace ? I'd rather avoid
 > using namespace std if it is...

It seems the other Polygon is global, not in the std namespace. What 
follows is more info about the build environment and what I did to try 
to figure it out.

$ msysinfo
msysinfo-1.3: Send this to the MSYS support list:

MSYS 1.0.10(0.46/3/2) 2004-03-15 07:17 i686 unknown; targ=MINGW32
GNU bash, version 2.04.0(1)-release (i686-pc-msys); ENV=.profile
GNU Make version 3.79.1,Built for i686-pc-msys; MAKE_MODE=unix
gcc.exe (GCC) 3.4.2 (mingw-special); targ=MINGW32
GNU ld version 2.15.91 20040904
    789320 Tue Mar 16 12:32:49 2004 /bin/msys-1.0.dll
     52064 Thu Jan 02 07:05:27 2003 /bin/msysltdl-3.dll
    135680 Tue Mar 16 12:32:48 2004 /bin/make.exe
     88064 Tue Sep 21 01:15:22 2004 /usr/local/bin/gcc.exe
    642048 Sat Sep 04 16:45:43 2004 /usr/local/bin/ld.exe

# this is the error with original XMLTester.cpp code:
$ cd source/test/
$ make
XMLTester.cpp:49: error: `Polygon' is already declared in this scope
make: *** [XMLTester.o] Error 1

# then I tried the -E option to see the preprocessed source:
g++  -DHAVE_CONFIG_H -I. -I. -I../..//source/headers 
  -I../../source/headers -I../../source/io/markup  -E -o XMLTester.i 

Resulting XMLTester.i contains the following declaration:
   BOOL __attribute__((__stdcall__)) Polygon(HDC,const POINT*,int);
which I don;t see is nested in any namespace.

I think it's a compiler bug to not accept the `using geos::Polygon' as 
a mechanism to hide any other possible Polygon declarations, even a 
global one (please anybody correct me if I'm wrong on this). Also note 
the gcc is rather recent (3.4.2).

So my workaround for now is to fully qualify geos::Polygon.


PS. BTW, ./XMLTester passes all tests.

More information about the geos-devel mailing list