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

  • Follow


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
0
Reply dtucker913 (8) 3/5/2004 7:18:17 PM

dtucker@arlut.utexas.edu (Don Tucker) wrote in
news:5ef0df46.0403051118.7f1393e5@posting.google.com: 

> 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. 

-- 
- Mark ->
--
0
Reply nospam243 (468) 3/5/2004 8:18:15 PM


Mark A. Odell wrote:
> dtucker@arlut.utexas.edu (Don Tucker) wrote in
> news:5ef0df46.0403051118.7f1393e5@posting.google.com: 
> 
>>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.

It's part of C99.

Don, what sort of errors are you getting?

-- 
Russell Hanneken
rghanneken@pobox.com
Remove the 'g' from my address to send me mail.
0
Reply rghanneken (67) 3/5/2004 8:59:47 PM

"Mark A. Odell" wrote:
> dtucker@arlut.utexas.edu (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.

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

-- 
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
   <http://cbfalconer.home.att.net>  USE worldnet address!


0
Reply cbfalconer (19183) 3/5/2004 9:51:30 PM

CBFalconer <cbfalconer@yahoo.com> wrote in
news:4048F318.939EC2E6@yahoo.com: 

>> > #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.
> 
> 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.

-- 
- Mark ->
--
0
Reply nospam243 (468) 3/5/2004 10:06:12 PM

CBFalconer wrote:

> 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.
0
Reply j.dot.willeke (18) 3/6/2004 1:27:19 AM

Jon Willeke wrote:
> CBFalconer wrote:
> 
>> 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.

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?

-- 
Joe Wright                            mailto:joewwright@comcast.net
"Everything should be made as simple as possible, but not simpler."
                     --- Albert Einstein ---
0
Reply joewwright (1737) 3/6/2004 2:38:08 AM

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

>> 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.  

which makes it non-conforming for a hosted impementation.

-- 
a signature
0
Reply not-a-real-address (328) 3/7/2004 2:27:02 AM

7 Replies
49 Views

(page loaded in 0.156 seconds)

Similiar Articles:











7/12/2012 2:26:35 PM


Reply: