This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: undefined reference to `MAIN__'
- From: Tobias Burnus <burnus at net-b dot de>
- To: chao sun <1988sunchao at gmail dot com>
- Cc: fortran at gcc dot gnu dot org
- Date: Tue, 25 Aug 2009 08:38:14 +0200
- Subject: Re: undefined reference to `MAIN__'
- References: <5a6ed0a80908242111k3ebea3e5rce35f01bf41a42bf@mail.gmail.com> <5a6ed0a80908242159t7ee19417wf4731a727fc08e9d@mail.gmail.com>
On 08/25/2009 06:59 AM, chao sun wrote:
> 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 think the most likely reason is that you do not include the file
containing the Fortran main program (the file containing "PROGRAM").
Another possibility is if you do mixed Fortran/C programming: In that
case you could have missed the C "main" function instead.
Tobias