[petsc-users] compile fortran module with PETSc

Josh Lo ysjosh.lo at gmail.com
Sat Apr 2 17:20:12 CDT 2016


Hi,

I am trying to compile my main source code with module.
I need PETSc in both main code and module, so I include the header file in
both.
it gives me some error when compiling.
The error is:

src/main.F:2.9:


      use fmodule

         2

Error: Symbol 'mpi_source' at (1) conflicts with symbol from module
'fmodule', use-associated at (2)

/Users/XXXXXXX/Desktop/project/petsc/petsc_3.6.3_install/include/mpif.h:10:30:


        PARAMETER (MPI_SOURCE=3,MPI_TAG=4,MPI_ERROR=5)

                              1
Error: Cannot change attributes of USE-associated symbol mpi_source at (1)




it goes on and on, most relates to MPI.

my main source code is like:

program main
USE fmodule
implicit none
#include "petsc/finclude/petsc.h"

.......


end program main

the module:

module fmodule
#include "petsc/finclude/petsc.h"

......

end module fmodule

if the I don't include the header file in module, then it is no error,
but I do need petsc in my module.

How can I solve this problem?


Thanks,
Lo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160402/54d1c2c8/attachment.html>


More information about the petsc-users mailing list