Go to the first, previous, next, last section, table of contents.


Cannot Link Fortran Programs

On some systems, perhaps just those with out-of-date (shared?) libraries, unresolved-reference errors happen when linking g77-compiled programs (which should be done using g77).

If this happens to you, try appending `-lc' to the command you use to link the program, e.g. `g77 foo.f -lc'. g77 already specifies `-lg2c -lm' when it calls the linker, but it cannot also specify `-lc' because not all systems have a file named `libc.a'.

It is unclear at this point whether there are legitimately installed systems where `-lg2c -lm' is insufficient to resolve code produced by g77.

If your program doesn't link due to unresolved references to names like `_main', make sure you're using the g77 command to do the link, since this command ensures that the necessary libraries are loaded by specifying `-lg2c -lm' when it invokes the gcc command to do the actual link. (Use the `-v' option to discover more about what actually happens when you use the g77 and gcc commands.)

Also, try specifying `-lc' as the last item on the g77 command line, in case that helps.


Go to the first, previous, next, last section, table of contents.