I am also not a Fortran programmer, but this can happen in c++ if you put a namespace (or scope) around your main program. Regards -----Original Message----- From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On Behalf Of chao sun Sent: Monday, August 24, 2009 9:57 PM To: gcc-help@xxxxxxxxxxx Subject: undefined reference to `MAIN__' Dear friends I compiled the Prep_sources_chem_cptec_wrf with the gfortran 4.4.0 and encountered some error. After I seted up the Fortran/C compilers and conducted 'make' the error message as follows came out:: gfortran -o prep_chem_sources \ prep_chem_sources.a ..//utils/bin/libutils-2.0-opt.a -I/usr/local/include -L/usr/local/lib -lnetcdf /usr/lib/gcc/i586-redhat-linux/4.4.0/libgfortranbegin.a(fmain.o): In function `main': (.text+0x27): undefined reference to `MAIN__' collect2: ld returned 1 exit status make: *** [prep_chem_sources] Error 1 I seted up the gfortran as follows: F_COMP=gfortran C_COMP=gcc LOADER=gfortran C_LOADER=gcc LIBS=-L/usr/local/lib -L/usr/lib -L/usr/lib/gcc/i586-redhat-linux/3.4.6 MOD_EXT=mod # Compiler options F_OPTS=-fconvert=big-endian -ffree-form $(NCDF_LIBS) -g C_OPTS=-O2 -DMAIN__=main_ LOADER_OPTS= C_LOADER_OPTS=-v