Hi Satish, Fix works. Thanks!
Erhan Erhan ________________________________ From: Satish Balay <[email protected]> Sent: Friday, September 9, 2022 6:53:38 PM To: erhan turan <[email protected]> Cc: [email protected] <[email protected]> Subject: Re: [petsc-users] multiple definition of `main' for a fortran example Looks like this makefile has a bug. Try the following change: diff --git a/src/dm/tutorials/makefile b/src/dm/tutorials/makefile index d169ab13df4..53bdf48284c 100644 --- a/src/dm/tutorials/makefile +++ b/src/dm/tutorials/makefile @@ -14,5 +14,4 @@ include ${PETSC_DIR}/lib/petsc/conf/variables include ${PETSC_DIR}/lib/petsc/conf/rules include ${PETSC_DIR}/lib/petsc/conf/test -ex13f90.o: ex13f90aux.o -ex13f90: ex13f90.o ex13f90aux.o +ex13f90: ex13f90aux.o Satish On Fri, 9 Sep 2022, erhan turan wrote: > Hello, > > I recently installed the latest version of Petsc and tried to build a case > with two fortran files (One main and one subroutine). I looked into similar > examples and found one in petsc/src/dm/tutorials: ex13f90.F90. This code > also needs a second file called ex13f90aux.F90 > > When I tried to build this example with "make ex13f90", I receive this > error warning: > > src/dm/tutorials/ex13f90.F90:24: multiple definition of `main' > src/dm/tutorials/ex13f90.F90:24: first defined here > > Hence, I was unable to run an example case from the tutorials folder. I > tested in two different pc's, one with Ubuntu 16 and one with Ubuntu 18. > Both cases use gnu compilers. Also test both mpich and openmpi. > > Are there anyone that saw a similar problem who knows a workaround to > resolve this issue? Maybe a makefile example with multiple fortran files > would be useful. Thanks. > > Best, > Erhan >
