math.h OR cmath includes

Alexandre Oliva oliva@dcc.unicamp.br
Tue Sep 22 16:36:00 GMT 1998


Helmut Jarausch <jarausch@IGPM.Rwth-Aachen.DE> writes:

> using version 1.1a on my SGI machine (IRIX6.2 Compilers 7.2)

> #include <math.h>

> The point is, that this does NOT have any    double abs(double)

Was it supposed to?  math.h is a C header-file, so it is not supposed
to declare any C++-only functions.

> So, I need to declare an inline function for that.

Where and how do you declare it?

> #include <complex.h>

> this in turn includes <cmath>  which does have a function   double abs(double)
> and therefore gives a redefinition error for my inline function.

Because <cmath> is a C++ header-file, that you should use in any C++
program, instead of <math.h>

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list