On Tue, Jan 20, 2004 at 07:05:24AM +0100, Matthias Klose wrote: > > --- > > #include <math.h> > > #include <cstdlib> > > > > using namespace std; > > > > int foo() { return llabs(1); } > > --- > > > > g++-3.3 blah.cc -c > > blah.cc: In function `int foo()': > > blah.cc:6: error: call of overloaded `llabs(int)' is ambiguous > > /usr/include/stdlib.h:754: error: candidates are: long long int llabs(long > > long > > int) > > /usr/include/c++/3.3/cstdlib:152: error: long long int > > __gnu_cxx::llabs(long long int) > > > > This works in g++ 3.2, but not 3.3. > > is this a bug at all?
<vector> pulls in <cstdlib>, so using <math.h> and <vector> together causes this problem. That is, it's triggered even if you don't use the <cstdlib> header: merely mixing vector with math.h triggers it, and it's impossible to avoid math.h (as library headers often pull it in.) This doesn't happen with other functions in cstdlib, such as abs(). Comments in /usr/include/c++/3.3/cstdlib indicate that it's intended to work ("// Get rid of those macros defined in <stdlib.h> ..."). -- Glenn Maynard