Opened 12 years ago

Closed 12 years ago

#2972 closed defect (fixed)

mysql compile error with GCC 4.3.2: error: macro "min" passed 3 arguments, but takes just 2

Reported by: Markus Neteler Owned by: warmerdam
Priority: normal Milestone: 1.6.1
Component: ConfigBuild Version: 1.6.0
Severity: normal Keywords:
Cc:

Description

I have updated to Mandriva 2009.1 and can no longer compile the mysql driver:

g++ -g -O2 -fPIC  -Wall  -I.. -I../.. -I/home/neteler/software/gdal/port -I/home/neteler/software/gdal/gcore -I/home/neteler/software/gdal/alg -I/home/neteler/software/gdal/ogr -I/home/neteler/software/gdal/ogr/ogrsf_frmts -I/usr/include/mysql -DOGR_ENABLED -I/home/neteler/software/gdal/port -I -I/include  -c -o ../o/ogrmysqldriver.o ogrmysqldriver.cpp
In file included from /usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/char_traits.h:46,
                 from /usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/string:47,
                 from /home/neteler/software/gdal/port/cpl_string.h:171,
                 from ../../ogr_featurestyle.h:34,
                 from ../../ogr_feature.h:34,
                 from ../ogrsf_frmts.h:33,
                 from ogr_mysql.h:41,
                 from ogrmysqldriver.cpp:30:
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:232:56: error: macro "min" passed 3 arguments, but takes just 2
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:252:56: error: macro "max" passed 3 arguments, but takes just 2
In file included from /usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/char_traits.h:46,
                 from /usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/string:47,
                 from /home/neteler/software/gdal/port/cpl_string.h:171,
                 from ../../ogr_featurestyle.h:34,
                 from ../../ogr_feature.h:34,
                 from ../ogrsf_frmts.h:33,
                 from ogr_mysql.h:41,
                 from ogrmysqldriver.cpp:30:
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:188: error: expected unqualified-id before 'const'
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:188: error: expected `)' before 'const'
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:188: error: expected `)' before 'const'
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:188: error: expected initializer before 'const'
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:210: error: expected unqualified-id before 'const'
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:210: error: expected `)' before 'const'
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:210: error: expected `)' before 'const'
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:210: error: expected initializer before 'const'
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:232: error: function definition does not declare parameters
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:252: error: function definition does not declare parameters
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h: In static member function 'static bool std::__lexicographical_compare<true>::__lc(const _Tp*, const _Tp*, const _Up*, const _Up*)':
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/stl_algobase.h:904: error: expected unqualified-id before '(' token
In file included from /usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/string:58,
                 from /home/neteler/software/gdal/port/cpl_string.h:171,
                 from ../../ogr_featurestyle.h:34,
                 from ../../ogr_feature.h:34,
                 from ../ogrsf_frmts.h:33,
                 from ogr_mysql.h:41,
                 from ogrmysqldriver.cpp:30:
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.h: In member function 'int std::basic_string<_CharT, _Traits, _Alloc>::compare(const std::basic_string<_CharT, _Traits, _Alloc>&) const':
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.h:1945: error: expected unqualified-id before '(' token
In file included from /usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/string:61,
                 from /home/neteler/software/gdal/port/cpl_string.h:171,
                 from ../../ogr_featurestyle.h:34,
                 from ../../ogr_feature.h:34,
                 from ../ogrsf_frmts.h:33,
                 from ogr_mysql.h:41,
                 from ogrmysqldriver.cpp:30:
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc: In member function 'typename std::basic_string<_CharT, _Traits, _Alloc>::size_type std::basic_string<_CharT, _Traits, _Alloc>::rfind(const _CharT*, typename _Alloc::rebind<_CharT>::other::size_type, typename _Alloc::rebind<_CharT>::other::size_type) const':
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc:759: error: expected unqualified-id before '(' token
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc: In member function 'int std::basic_string<_CharT, _Traits, _Alloc>::compare(typename _Alloc::rebind<_CharT>::other::size_type, typename _Alloc::rebind<_CharT>::other::size_type, const std::basic_string<_CharT, _Traits, _Alloc>&) const':
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc:896: error: expected unqualified-id before '(' token
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc: In member function 'int std::basic_string<_CharT, _Traits, _Alloc>::compare(typename _Alloc::rebind<_CharT>::other::size_type, typename _Alloc::rebind<_CharT>::other::size_type, const std::basic_string<_CharT, _Traits, _Alloc>&, typename _Alloc::rebind<_CharT>::other::size_type, typename _Alloc::rebind<_CharT>::other::size_type) const':
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc:913: error: expected unqualified-id before '(' token
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc: In member function 'int std::basic_string<_CharT, _Traits, _Alloc>::compare(const _CharT*) const':
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc:929: error: expected unqualified-id before '(' token
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc: In member function 'int std::basic_string<_CharT, _Traits, _Alloc>::compare(typename _Alloc::rebind<_CharT>::other::size_type, typename _Alloc::rebind<_CharT>::other::size_type, const _CharT*) const':
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc:945: error: expected unqualified-id before '(' token
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc: In member function 'int std::basic_string<_CharT, _Traits, _Alloc>::compare(typename _Alloc::rebind<_CharT>::other::size_type, typename _Alloc::rebind<_CharT>::other::size_type, const _CharT*, typename _Alloc::rebind<_CharT>::other::size_type) const':
/usr/lib/gcc/x86_64-manbo-linux-gnu/4.3.2/../../../../include/c++/4.3.2/bits/basic_string.tcc:961: error: expected unqualified-id before '(' token
make: *** [../o/ogrmysqldriver.o] Error 1


uname -a
Linux host550 2.6.29.1-server-4mnb #1 SMP Mon Apr 20 17:17:54 EDT 2009 x86_64 Intel(R) Core(TM)2 CPU         T5500  @ 1.66GHz GNU/Linux

gcc --version
gcc (GCC) 4.3.2

Change History (1)

comment:1 Changed 12 years ago by Even Rouault

Component: OGR_SFConfigBuild
Milestone: 1.6.1
Resolution: fixed
Status: newclosed
Version: svn-trunk1.6.0

Yes, reproduced. my_global.h declares the min(a,b) and max(a,b) macros (bad idea), and an header file from g++-4.3.2 declares a min(a,b,c) in a template...

Fixed in trunk (r16921) and branches/1.6 (r16922)

Note: See TracTickets for help on using tickets.