fmain.c:21: undefined reference to `_MAIN__'

Hans Horn hannes@2horns.com
Mon May 19 05:02:00 GMT 2008


Tim,

good suggestion - nm shows that there's infact NO main!
Turned out that there were some weird chars in my mymain.f90 source
Thanks for the good lead.

H

Tim Prince wrote:
> Hans Horn wrote:
> 
>>
>> Compiling works:
>> gfortran -c a.f90 b.f90 mymain.f90
>>
>> When I try to link:
>> gfortran -o mymain a.o b.o mymain.o
>>
>> I get
>>
>> /usr/local/gfortran/lib/gcc/i686-pc-cygwin/4.3.0/libgfortranbegin.a(fmain.o): 
>> In function `main':
>> ../../../gcc43/libgfortran/fmain.c:21: undefined reference to `_MAIN__'
> 
> If you actually have a main program (PROGRAM or f66-style implied 
> PROGRAM), _MAIN__ should be present in that .o file, and visible to nm 
> or objdump.



More information about the Fortran mailing list