<div dir="ltr"><div dir="ltr">On Wed, Mar 13, 2019 at 7:36 PM Maahi Talukder via petsc-users <<a href="mailto:petsc-users@mcs.anl.gov">petsc-users@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Dear All,</div><div dir="ltr"><br></div><div dir="ltr">I am trying to compile a Fortran code. The make is as it follows- <br><div><br></div><div><div>............................................................................................................................................................................................................................</div><div>#<span style="white-space:pre-wrap"> </span>Makefile for egrid2d</div><div><br></div><div>OBJS<span style="white-space:pre-wrap"> </span>= main.o egrid2d.o</div><div><br></div><div>FFLAGS = -I/home/maahi/petsc/include -I/home/maahi/petsc/arch-linux2-c-debug/include -Ofast -fdefault-real-8</div><div><br></div><div>#</div><div># link</div><div>#</div><div>include ${PETSC_DIR}/lib/petsc/conf/variables</div><div>include ${PETSC_DIR}/lib/petsc/conf/rules</div><div><br></div><div>egrid2d: $(OBJS)</div><div><br></div><div><span style="white-space:pre-wrap"> </span> ${FLINKER} $(OBJS) -o egrid2d ${PETSC_LIB}</div></div></div></div></div></div></div></blockquote><div><br></div><div>Move this above your includes</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div><br></div><div>#</div><div># compile</div><div>#</div><div>main.o:</div><div><span style="white-space:pre-wrap"> </span> ${FLINKER} -c $(FFLAGS) main.f ${PETSC_LIB} </div></div></div></div></div></div></div></blockquote><div><br></div><div>You should not need this rule.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div>#</div><div># Common and Parameter Dependencies</div><div>#</div><div><br></div><div>main.o: main.f par2d.f</div><div>egrid2d.o: egrid2d.f par2d.f</div></div><div>.....................................................................................................................................................................................................................................</div><div><br></div><div>But I get the following error- </div><div><br></div><div>..............................................................................................................................................................................</div><div><div>/home/maahi/petsc/arch-linux2-c-debug/bin/mpif90 -Wall -ffree-line-length-0 -Wno-unused-dummy-argument -g -I/home/maahi/petsc/include -I/home/maahi/petsc/arch-linux2-c-debug/include -Ofast -fdefault-real-8 -o egrid2d -Wl,-rpath,/home/maahi/petsc/arch-linux2-c-debug/lib -L/home/maahi/petsc/arch-linux2-c-debug/lib -Wl,-rpath,/home/maahi/petsc/arch-linux2-c-debug/lib -L/home/maahi/petsc/arch-linux2-c-debug/lib -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/7 -L/usr/lib/gcc/x86_64-redhat-linux/7 -lpetsc -lflapack -lfblas -lm -lpthread -lstdc++ -ldl -lmpifort -lmpi -lgfortran -lm -lgfortran -lm -lgcc_s -lquadmath -lstdc++ -ldl</div><div>/<i><b>usr/lib/gcc/x86_64-redhat-linux/7/../../../../lib64/crt1.o: In function `_start':</b></i></div><div><i><b>(.text+0x20): undefined reference to `main'</b></i></div><div>collect2: error: ld returned 1 exit status</div><div>make: *** [makefile:18: egrid2d] Error 1</div></div><div>........................................................................................................................................</div><div><br></div><div>Any idea how to fix it ?</div><div><br></div><div>Thanks,</div><div>Maahi Talukder</div><div><br></div><div><br></div><div><br></div></div></div></div></div></div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>