Reputation: 43
I'm executing this makefile to compile a Fortran code using gfortran, gcc, netcdf and mpich2 libraries.
When the make script executes the following command,
gfortran -O3 -I/home/santiago/Install/mpich2_sam/include -I/home/santiago/Install/netcdf_sam/include /home/santiago/Modeling/SAM6.8.2/SRC/fft.f
I get the following message:
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/crt1.o: In function
_start': (.text+0x20): undefined reference to
main' collect2: error: ld returned 1 exit status
I have found similar error messages in forums, but I didn't saw how to apply the solutions in my problem.
Could someone please guide me solving this problem?
Upvotes: 2
Views: 2235
Reputation: 6214
If you are building a library, you might need -c
flag in
.f.o:
${FF77} ${FFLAGS} $<
i.e.
.f.o:
${FF77} ${FFLAGS} -c $<
The same applies for
.f90.o:
${FF90} ${FFLAGS} -c $<
.c.o:
${CC} ${CFLAGS} -I$(SAM_SRC)/TIMING $(NOTIMERS) -c $<
Upvotes: 2