[gdal-dev] Problems compiling GDAL 1.5.1

Bill Thoen bthoen at gisnet.com
Wed Jun 18 19:12:16 EDT 2008


I ran into a problem compiling GDAL 1.5.1 on my Linux Fedora Core 9 
system. The error seems to be caused by max and min macros with the 
wrong number of parameters. Anyone else run into this and what's the fix?

Below is the relevant section of the log that reported this:

/bin/sh /home/bthoen/Install/gdal-1.5.1/libtool --mode=compile --tag=CXX 
g++ -g -O2  -Wall  -I. -I.. -I../.. 
-I/home/bthoen/Install/gdal-1.5.1/port 
-I/home/bthoen/Install/gdal-1.5.1/gcore 
-I/home/bthoen/Install/gdal-1.5.1/alg 
-I/home/bthoen/Install/gdal-1.5.1/ogr 
-I/home/bthoen/Install/gdal-1.5.1/ogr/ogrsf_frmts -DOGR_ENABLED 
-I/home/bthoen/Install/gdal-1.5.1/port  -c -o ../o/ogrgeojsonlayer.o 
ogrgeojsonlayer.cpp
libtool: compile:  g++ -g -O2 -Wall -I. -I.. -I../.. 
-I/home/bthoen/Install/gdal-1.5.1/port 
-I/home/bthoen/Install/gdal-1.5.1/gcore 
-I/home/bthoen/Install/gdal-1.5.1/alg 
-I/home/bthoen/Install/gdal-1.5.1/ogr 
-I/home/bthoen/Install/gdal-1.5.1/ogr/ogrsf_frmts -DOGR_ENABLED 
-I/home/bthoen/Install/gdal-1.5.1/port -c ogrgeojsonlayer.cpp  -fPIC 
-DPIC -o ../o/.libs/ogrgeojsonlayer.o
In file included from 
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_algo.h:66,
                 from 
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/algorithm:67,
                 from ogrgeojsonlayer.cpp:32:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:248:41: 
error: macro "max" passed 3 arguments, but takes just 2
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:259:41: 
error: macro "min" passed 3 arguments, but takes just 2
In file included from 
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_algo.h:66,
                 from 
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/algorithm:67,
                 from ogrgeojsonlayer.cpp:32:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:244: 
error: expected unqualified-id before 'const'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:244: 
error: expected `)' before 'const'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:244: 
error: expected `)' before 'const'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:244: 
error: expected initializer before 'const'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:248: 
error: template declaration of 'const _Tp& std::max'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:255: 
error: expected unqualified-id before 'const'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:255: 
error: expected `)' before 'const'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:255: 
error: expected `)' before 'const'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:255: 
error: expected initializer before 'const'
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/algorithmfwd.h:259: 
error: template declaration of 'const _Tp& std::min'
In file included from 
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/algorithm:67,
                 from ogrgeojsonlayer.cpp:32:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_algo.h: 
In function 'void std::__merge_sort_loop(_RandomAccessIterator1, 
_RandomAccessIterator1, _RandomAccessIterator2, _Distance)':
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_algo.h:2884: 
error: expected unqualified-id before '(' token
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_algo.h: 
In function 'void std::__merge_sort_loop(_RandomAccessIterator1, 
_RandomAccessIterator1, _RandomAccessIterator2, _Distance, _Compare)':
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_algo.h:2908: 
error: expected unqualified-id before '(' token
ogrgeojsonlayer.cpp: In member function 'void 
OGRGeoJSONLayer::DetectGeometryType()':
ogrgeojsonlayer.cpp:377: warning: unused variable 'lyrType'
make[3]: *** [../o/ogrgeojsonlayer.o] Error 1
make[3]: Leaving directory 
`/home/bthoen/Install/gdal-1.5.1/ogr/ogrsf_frmts/geojson'
make[2]: *** [geojson-target] Error 2
make[2]: Leaving directory `/home/bthoen/Install/gdal-1.5.1/ogr/ogrsf_frmts'
make[1]: *** [sublibs] Error 2
make[1]: Leaving directory `/home/bthoen/Install/gdal-1.5.1/ogr'
make: *** [ogr-target] Error 2



More information about the gdal-dev mailing list