Compile for complex number computation

Hi,

Using pgcc compiler, unlike using intel compiler, I am encountering the following error message:

“/opt/pgi/linux86-64/18.5/include/complex.h”, line 33 : error: expected a “;”
double complex conj (double complex);

“/opt/pgi/linux86-64/18.5/include/complex.h”, line 34 : error : variable “complex” has already been defined
double complex cexp(double complex);

“/opt/pgi/linux86-64/18.5/include/complex.h”, line 34 : error: expected a “;”
double complex cexp (double complex);

this goes on and on.

Anyone knows how to solve this problem ?

Regards,
Phoon

Hi Phoon,

Are you sure you’re using pgcc and not pgc++? I ask because I can only recreate this error with pgc++ while pgcc works fine since “complex.h” is a C header file. Typically, C++ will using the “complex” header file instead.

If you do need to compile the C complex.h header file with pgc++, please add the “-Mnobuiltin” flag.

-Mat

Hi Mat,


Are you sure you’re using pgcc and not pgc++? I ask because I can only recreate this error with pgc++ while pgcc works fine since “complex.h” is a C header file. Typically, C++ will using the “complex” header file instead.

My bad, I am using pgc++.

If you do need to compile the C complex.h header file with pgc++, please add the “-Mnobuiltin” flag.

This solves the problem