<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<div>
<div>
<div dir="ltr">
<div dir="ltr">Hi Satish,</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Fix works. Thanks!</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Erhan</div>
</div>
</div>
<div id="ms-outlook-mobile-signature">
<div><br>
</div>
<div style="direction: ltr;">Erhan</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Satish Balay <balay@mcs.anl.gov><br>
<b>Sent:</b> Friday, September 9, 2022 6:53:38 PM<br>
<b>To:</b> erhan turan <turane@gmail.com><br>
<b>Cc:</b> petsc-users@mcs.anl.gov <petsc-users@mcs.anl.gov><br>
<b>Subject:</b> Re: [petsc-users] multiple definition of `main' for a fortran example</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Looks like this makefile has a bug. Try the following change:<br>
<br>
diff --git a/src/dm/tutorials/makefile b/src/dm/tutorials/makefile<br>
index d169ab13df4..53bdf48284c 100644<br>
--- a/src/dm/tutorials/makefile<br>
+++ b/src/dm/tutorials/makefile<br>
@@ -14,5 +14,4 @@ include ${PETSC_DIR}/lib/petsc/conf/variables<br>
 include ${PETSC_DIR}/lib/petsc/conf/rules<br>
 include ${PETSC_DIR}/lib/petsc/conf/test<br>
 <br>
-ex13f90.o: ex13f90aux.o<br>
-ex13f90: ex13f90.o ex13f90aux.o<br>
+ex13f90: ex13f90aux.o<br>
<br>
<br>
Satish<br>
<br>
On Fri, 9 Sep 2022, erhan turan wrote:<br>
<br>
> Hello,<br>
> <br>
> I recently installed the latest version of Petsc and tried to build a case<br>
> with two fortran files (One main and one subroutine). I looked into similar<br>
> examples and found one in petsc/src/dm/tutorials: ex13f90.F90. This code<br>
> also needs a second file called ex13f90aux.F90<br>
> <br>
> When I tried to build this example with "make ex13f90",  I receive this<br>
> error warning:<br>
> <br>
> src/dm/tutorials/ex13f90.F90:24: multiple definition of `main'<br>
> src/dm/tutorials/ex13f90.F90:24: first defined here<br>
> <br>
> Hence, I was unable to run an example case from the tutorials folder. I<br>
> tested in two different pc's, one with Ubuntu 16 and one with Ubuntu 18.<br>
> Both cases use gnu compilers. Also test both mpich and openmpi.<br>
> <br>
> Are there anyone that saw a similar problem who knows a workaround to<br>
> resolve this issue? Maybe a makefile example with multiple fortran files<br>
> would be useful. Thanks.<br>
> <br>
> Best,<br>
> Erhan<br>
> <br>
<br>
</div>
</span></font></div>
</body>
</html>