Fortran User's 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, -dbl, -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; passes  -a  to the linker

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

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