Compiling and Linking a Single Source File
The following command compiles x.for, links, and creates an executable file. This command generates a temporary object file, which is deleted after linking:
ifort x.for
To specify a particular name for the executable file, specify the -o (Linux* OS and Mac OS* X) or /exe (Windows* OS) option:
ifort x.for -o myprog.out (Linux OS and Mac OS X) ifort x.for /exe:myprog.exe (Windows OS)
Compiling, but not Linking, a Source File
The following command compiles x.for and generates the object file x.o (Linux OS and Mac OS X) or x.obj (Windows OS). The c option prevents linking (it does not link the object file into an executable file):
ifort -c x.for (Linux OS and Mac OS X) ifort x.for /c (Windows OS)
The following command links x.o or x.obj into an executable file. This command automatically links with the default Intel Fortran libraries:
ifort x.o (Linux OS and Mac OS X) ifort x.obj (Windows OS)
Compiling and Linking Multiple Fortran Source Files
The following command compiles a.for, b.for, and c.for. It creates three temporary object files, then links the object files into an executable file named a.out (on Linux OS and Mac OS X) or a.exe(Windows OS):
ifort a.for b.for c.for
When you use modules and compile multiple files, compile the source files that define modules before the files that reference the modules (in USE statements).
When you use a single ifort command, the order in which files are placed on the command line is significant. For example, if the free-form source file moddef.f90 defines the modules referenced by the file projmain.f90, use the following command:
ifort moddef.f90 projmain.f90
Note: this post is from http://software.intel.com/sites/products/documentation/hpc/compilerpro/en-us/fortran/lin/compiler_f/bldaps_for/common/bldaps_exifort.htm.
Aucun commentaire:
Enregistrer un commentaire