You are confusing object files with static libraries. An object file
is not a static library and the gfortran linker - which is simply
the GNU system linker, invoked by gfortran - will not treat it as such.
You need a static library and you are trying to use object files in lieu. 

The linker recognizes an object file by the extension .o. It recognizes
a static library by the extension .a, and it expects the contents of an .a file
to have the form of a static library, not the format of an object file. (So you
cannot make an object file into a static library just by renaming it).

The linker will link into your program every object file that appears on its
commandline, whether or not it is needed. It does not expect you to mention
object files if you don't want them linked. The linker options -L and -l for
locating libraries have no application to object files.

A static library is a fairly simple archive containing some number of
object files, plus a house-keeping header and typically an index of the
public symbols defined in the contained object files.

When the linker encounters a static library on its commandline, it does not
link the entire contents of the library (unless you expressly tell it to). It inspects
the contained object files to determine which, if any, of them contain
definitions for symbols that are as yet undefined at that point in the linkage
of the program. If any object file in the library is found to provide any
of the missing definitions, then that object file is extracted from the library
and linked into the program. Object files in the library that provide no
missing definitions are not linked. Libraries on the commandline are sequentially
inspected in this way until either all the symbols referred to by the program 
have definitions in linked object files or there are no more libraries.

If as you say the object files that you are trying to use as libraries are stable
resources that you never have to build for your projects, then you can just make a static
library out of them and link that library with your per-project programs.

To make a static library from object files, use the ar tool. 
See man ar.

When you have made your library, say, libsubs.a, and have decided it shall reside
in some directory, /path/to/subs, then you link it with a program by adding

    -L/path/to/subs -lsubs


to the commandline in which your program is linked. This will cause the linker
to search for a library called libsubs.a in directory /path/to/subs.

So if you are compiling and linking in a single step, use it like:

gfortran -o myprog myprog.f90 -L/path/to/subs -lsubs


And if you are compiling and linking in distinct steps, use it like:

gfortran -c -o myprog_1st_file.o myprog_1st_file.f90
gfortran -c -o myprog_2nd_file.o myprog_2nd_file.f90
gfortran -o myprog myprog_1st_file.o myprog_2nd_file.o -L/path/to/subs -lsubs


This is how you are supposed to use a set of object file resources of which
different subsets will be required for linkage with different programs: you put
them in a library and link the library.

Link multiple object files in gfortran
I am building a little pen plotter.

It is powered by a 12V 1.0A wall wart, as well as by a standard USB connection.

There is an Arduino Duemilanove, which will draw 120mA for the Atmega328 as well as 50mA for the control pins.

Attached to the control pins are three Easydrivers, that are supposed to draw 150mA apiece, and they are connected to stepper motors with 6 Ohm windings. these easydrivers are powered from VIN.

Also powered from VIN is a 12V 2.08W fan, which will run continuously.



Will this run without blowing something up?
