pgcc vs. gcc question - using <complex.h>

D

Don Tucker

Hello, I have the following test program that I can compile with gcc,
but when I try to compile with the portland group compiler, pgcc, I
get a stream of errors.

#include <stdio.h>
#include <complex.h>

int main(int argc, char **argv){
complex double a={2.3+1.4*_Complex_I};
printf("a=%lf + i%lf\n",creal(a),cimag(a));
return 0;
}

I am able to use <complex> instead, and use the C++ complex class and
compile with pgCC, but since I eventually want to pass an array of
complex numbers to a Fortran function, this method is not appealing.
Is there some compiler directive that I need to use in order not to
get all of the errors?

Don
 
M

Mark A. Odell

(e-mail address removed) (Don Tucker) wrote in

Hello, I have the following test program that I can compile with gcc,
but when I try to compile with the portland group compiler, pgcc, I
get a stream of errors.

#include <stdio.h>
#include <complex.h>

Is complex.h part of ISO C? If it's a gcc thing, you'd be better off
asking in one of the appropriate gnu newsgroups.
 
R

Russell Hanneken

Mark said:
(e-mail address removed) (Don Tucker) wrote in



Is complex.h part of ISO C? If it's a gcc thing, you'd be better off
asking in one of the appropriate gnu newsgroups.

It's part of C99.

Don, what sort of errors are you getting?
 
C

CBFalconer

Mark A. Odell said:
(e-mail address removed) (Don Tucker) wrote in


Is complex.h part of ISO C? If it's a gcc thing, you'd be better
off asking in one of the appropriate gnu newsgroups.

No, it's all quite valid. The only problem is that it needs a C99
compliant compiler, which pgcc appears not to be. He would have
found out (I think) with gcc if he used -ansi -pedantic which
restricts to C90. He could also have used --std=C99 -pedantic and
had things work.

Minimum gcc flags for portability: -W -Wall -ansi -pedantic
 
M

Mark A. Odell

No, it's all quite valid. The only problem is that it needs a C99
compliant compiler, which pgcc appears not to be. He would have

I learn something new everyday. Thanks.
 
J

Jon Willeke

CBFalconer said:
No, it's all quite valid. The only problem is that it needs a C99
compliant compiler, which pgcc appears not to be.

Perhaps PGCC ships without a C99 library. Comeau C/C++ is advertised as
having "amazing C99 support," but is dependent on something like Dinkum
for full C99 support.
 
J

Joe Wright

Jon said:
Perhaps PGCC ships without a C99 library. Comeau C/C++ is advertised as
having "amazing C99 support," but is dependent on something like Dinkum
for full C99 support.

Both Comeau and Dinkum are commercial things and cost a little money.
Greg and PJ are apparently cooperating to provide a C99 compiler product
to those who want it. What's the problem with Comeau + Dinkum?
 
T

those who know me have no need of my name

in comp.lang.c i read:
CBFalconer wrote:

Perhaps PGCC ships without a C99 library.

which makes it non-conforming for a hosted impementation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top