Child pages
  • Mox_ranlib
Skip to end of metadata
Go to start of metadata

Below examples can also be used with ifort instead of gfortran.

Suppose trial1.f and trial2.f contain some subroutines. We can compile them without producing an executable by using below commands:

gfortran -c trial1.f
gfortran -c trial2.f

Above two commands will produce trial1.o and trial2.o files.

We can now combine them into one file by using below steps:

ar -cr libtrial.a trial1.o trial2.o
ranlib libtrial.a

Suppose somefile.f uses the subroutines in trial1.f and trial2.f.
We can now compile somefile.f with below command:

gfortran somefile.f libtrial.a

  • No labels