Operating System - HP-UX
1826373 Members
4251 Online
109692 Solutions
New Discussion

We have ANSI c but where to invoke cc

 
SOLVED
Go to solution
Frank de Vries
Respected Contributor

We have ANSI c but where to invoke cc

We have still an old hpux 10.00

I need to compile some c sources,
it was done there before years ago by
my predeccor.

When I compile it complains :
line 118: error 1705: Function prototypes are an ANSI feature.

The thing is I am certain we purchased a license and swlist confirms we have ANSI c
(not just the Bundled version)

[root@devor:]/root/kitchen<>>> swlist -l product | grep ANSI
C-ANSI-C B.10.20.00 HP C/ANSI C Compiler
[root@devor:]/root/kitchen<>>>

Is there some specific options I have to pass in order to invoke the ANSI part of cc ?

It has been a long time, or I am just fading older :)
Look before you leap
6 REPLIES 6

Re: We have ANSI c but where to invoke cc

are you making sure you invoke the ANSI C compiler (can't remember where it is on 10.20, maybe in /opt/ansic/bin ??) If you are not specifying this anywhere you are probably just defaulting to the bundled compiler in /usr/bin (check by issuing "whence cc")

HTH

Duncan

I am an HPE Employee
Accept or Kudo
TTr
Honored Contributor
Solution

Re: We have ANSI c but where to invoke cc

Verify that when you type "cc", the anciC command is invoked. Type "which cc", it should give you /usr/bin/cc, then type "ll /usr/bin/cc" it should be a symbolic link to /opt/ansic/bin/cc. that's the ansic compiler. If the /usr/bin/cc points to /usr/ccs/bin/cc, that is not ansic. Now, after you verify/fix this, your source code may need (other) specific options to compile correctly.
Frank de Vries
Respected Contributor

Re: We have ANSI c but where to invoke cc

TTr , your answer is usefull.

We have /usr/bin/cc linked to ansi c

[root@devor:]/root/kitchen<>>> ls -l /usr/ccs/bin/cc
-r-xr-xr-x 1 bin bin 172032 Jun 10 1996 /usr/ccs/bin/cc*
[root@devor:]/root/kitchen<>>> ls -altr /opt/ansic/bin/cc
-r-xr-xr-x 1 bin bin 249856 Jun 5 1996 /opt/ansic/bin/cc*
[root@devor:]/root/kitchen<>>> ^B
[root@devor:]/root/kitchen<>>> ls -altr /usr/bin/cc
lrwxrwxrwt 1 root sys 17 Aug 29 1999 /usr/bin/cc@ -> /opt/ansic/bin/cc
[root@devor:]/root/kitchen<>>>


After some playing with the cc options
it appears that I needed to use this

/opt/ansic/bin/cc -Ae -w source.c -o prog

That compiled and worked !!


Thx
Look before you leap
Frank de Vries
Respected Contributor

Re: We have ANSI c but where to invoke cc

ok
Look before you leap
Steven Schweda
Honored Contributor

Re: We have ANSI c but where to invoke cc

> We have /usr/bin/cc linked to ansi c

So why were you getting the bundled compiler
from "cc"?

> Type "which cc" [...]

Still a good idea. Unless you _really_ want
"cc" to give you the (lame) bundled compiler,
it would seem that adjusting your PATH so
that "cc" gets you the (expensive)
"purchased" compiler would be a wise move.
Dennis Handly
Acclaimed Contributor

Re: We have ANSI c but where to invoke cc

>Steven: it would seem that adjusting your PATH

Right. If you just take your PATH from /etc/PATH, there may have been problems that long ago such that /usr/ccs/bin may be first?
My 11.11 one is awfully close to not working:
/usr/bin:/opt/ansic/bin:/usr/ccs/bin:...