Compiling with pgCC and including complex.h

Based on this post

we just upgraded our compilers to version 6.1-3 and rebuilt mpich accordingly. However, we still get the same error message, even for a simple test program which just includes complex.h. Does the 6.1-3 version support this part of C99? If so, can someone point the way out of my confusion?


Hi ghoti,

C99 Complex numbers are supported in both pgcc and pgCC. With pgcc you would use the “complex.h” header file. However, pgCC uses the C++ header file “complex”. So changing “#include <complex.h>” to "#include " will allow you to use compex numbers with pgCC.

Hope this helps,


I’ll give that a shot.

I am having the same issue with pgcc version 6.1-3, when add
#include “complex.h” I get the same error messages a in the post


To use “complex.h” with the 6.1 pgcc compiler, you need to enable C99 support by adding the “-c9x” flag. Note that “-c9x” is used by default with the 6.2 compilers.

Hope this helps,

% cat cmp.c
#include <complex.h>

int main () {
% pgcc -V6.1-3 cmp.c -c9x