197. Create an executable in one step by compiling all source files or by compiling source files with -c and linking the object files.#
topic: Compiling
Note
This tip is a draft1.
A program containing a module and main program is compiled with g95 as
g95 m.f90 main.f90
or with separate compilation
create m.o and main.o with the -c option#
g95 -c m.f90 g95 -c main.f90
link objects to create exec#
g95 -o exec m.o main.f90
Other compilers are similar.
A program containing a module and main program is compiled with g95 as
— FortranTip (@fortrantip) April 21, 2022
g95 m.f90 main.f90
or with separate compilation
# create m.o and main.o with the -c option
g95 -c m.f90
g95 -c main.f90
# link objects to create exec
g95 -o exec m.o main.f90
Other compilers are similar.
- 1
From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.