Hi, unfortunately VMS doesn't like to include complex.h after math.h, while the reverse is allowed. The reason is that math.h (unless ANSI_C_SOURCE is defined but that hides many math functions) declares cabs/cabsf/cabsl for a structure representing a complex number, which is not compatible with the declarations in complex.h
The simplest path is simply to reverse the include order in libgfortran.h. I know that this is somewhat VMS specific, and I welcome better ideas. Tested by building gfortran for x86_64-darwin and ia64-hp-openvms. Ok for trunk ? Tristan. libgfortran/ 2012-04-03 Tristan Gingold <ging...@adacore.com> * libgfortran.h: Include complex.h before math.h diff --git a/libgfortran/libgfortran.h b/libgfortran/libgfortran.h index be5f133..ea20e14 100644 --- a/libgfortran/libgfortran.h +++ b/libgfortran/libgfortran.h @@ -42,11 +42,19 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "config.h" #include <stdio.h> -#include <math.h> #include <stddef.h> #include <float.h> #include <stdarg.h> +#if HAVE_COMPLEX_H +/* Must appear before math.h on VMS systems. */ +# include <complex.h> +#else +#define complex __complex__ +#endif + +#include <math.h> + /* If we're support quad-precision floating-point type, include the header to our support library. */ #ifdef HAVE_FLOAT128 @@ -66,12 +74,6 @@ extern long double __strtold (const char *, char **); #define gfc_strtold strtold #endif -#if HAVE_COMPLEX_H -# include <complex.h> -#else -#define complex __complex__ -#endif - #include "../gcc/fortran/libgfortran.h" #include "c99_protos.h"