Hi, I have a Fortran program that's intended to link against some C++ code. As far as I can tell, the way to do this is to use gfortran to create a .o file from the Fortran code, and link everything using g++. However, this gives me an error. Leaving out the C++ code, here is the simplest example of my problem: 1. Make a file Solver.f90 containing: PROGRAM Solver INTEGER :: foo END PROGRAM Solver 2. gfortran -c Solver.f90 3. g++ Solver.o /usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o: In function `_start': /build/buildd/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main' Solver.o: In function `MAIN__': Solver.f90:(.text+0x16): undefined reference to `_gfortran_set_options' collect2: ld returned 1 exit status Alternatively, I can try with the -lgfortran flag: 4. g++ Solver.o -lgfortran /usr/lib/gcc/i486-linux-gnu/4.3.3/../../../../lib/crt1.o: In function `_start': /build/buildd/glibc-2.9/csu/../sysdeps/i386/elf/start.S:115: undefined reference to `main' collect2: ld returned 1 exit status Both gfortran and g++ are from the same version (Ubuntu 4.3.3-5ubuntu4). I'm sure I'm missing something silly; can anyone suggest a solution?