[petsc-users] multiple definition of `main' for a fortran example

erhan turan turane at gmail.com
Fri Sep 9 06:56:24 CDT 2022


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220909/50b96c09/attachment.html>


More information about the petsc-users mailing list