This content has been marked as final. Show 3 replies
Please refer to the C Users Guide for details of cc command line options. All manuals for Sun Studio 12u1 are listed here:
There is no -ansi option in Sun/Oracle C, nor has there ever been. The compiler attempts to interpret it as -a followed by some other letters, which is why you get a complaint about -a. Remove the option.
Depending on what you expect from the -ansi option, either the default compiler behavior or the -Xc option should work. I suggest trying the default behavior (no -X option). Refer to the manual for details.
Always use the /usr/ccs/bin/ld linker, but you normally should not use the ld linker directly. If you mixing C and Fortran, use the f90 driver to do the linking; it knows what Fortran libraries need to be linked, depending on command line option. When linking a program using only C, use the cc driver to link. Some C command-line options require linking special system files; the cc and f90 drivers know the rules.
To mix Fortran with C, refer to the Fortran Users Guide. I recommend using the Studio C compiler when mixing code, not gcc. The requirements of gcc are not known to the f90 driver, but it does know the requirements of Studio C.
The schema for a mixed Fortran and C program is something like this:
cc -c f1.c f2.c <other options> f90 -c f3.f90 f4.f90 <other options> f90 -o myprog f1.o f2.0 f3.0 f4.0 <other options>
Sorry, I misread your question as applying to C5.10 instead of Studio 10. It does not appear that documentation for Studio 10 is available online. Normal support for Studio 10 ended in Jan 2010, although you can still get Oracle Extended (or Premier) Support for it.
My comments about command-line options and the use of the cc and f90 drivers still apply.