To make the .modfiles available to the compiler, you must therefore compile the files that define modules before the files that use modules. Likewise, if you make changes to a file that defines a module, you must recompile that file as well as any files that use the module, in that order.

Also, if a module is defined and used in the same file, the definition must lexically precede

anyUSEstatements that reference the module. This requirement allows the compiler to generate the

.modfile first, so that it can resolve the references in any USEstatements.

This section discusses the following topics:

How to compile a program that uses modules

How to design makefiles to work with modules

How to use the -Iand +moddiroptions to manage .modfiles

Special-purpose compilations

55