Fortran Programming Guide

Consistent Compiling and Linking

Ensuring a consistent choice of compiling and linking options is critical whenever compilation and linking are done in separate steps. Compiling any part of a program with any of the following options requires linking with the same options:

-a, -autopar, -Bx, -fast, -G, -Lpath, -lname,-mt, -nolib, -norunpath, -p, -pg, -xlibmopt, -xlic_lib=name, -xprofile=p

Example: Compiling sbr.f with -a and smain.f without it, then linking in separate steps (-a invokes tcov old style profiling):


 demo% f77 -c -a sbr.f       
 demo% f77 -c smain.f
 demo% f77 -a sbr.o smain.o   {link step; pass -a to the linker}

Also, a number of options require that all source files be compiled with that option. These include:

-autopar, -cg92, -dx, -dalign, -dbl, -explicitpar, -f, -misalign, -native, -parallel, -pentium, -PIC, -pic, -xarch=a, -xcache=c, -xchip=c, -xF, -xtarget=t, -ztext

See the f77(1) and f90(1) man pages and the Fortran User's Guide for details on all compiler options.