[petsc-users] compile fortran module with PETSc

Matthew Knepley knepley at gmail.com
Sat Apr 2 17:23:24 CDT 2016


On Sat, Apr 2, 2016 at 5:20 PM, Josh Lo <ysjosh.lo at gmail.com> wrote:

> 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?
>

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/UsingFortran.html

Change the include.

  Thanks

     Matt


> Thanks,
> Lo
>
>


-- 
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160402/05fcb872/attachment.html>


More information about the petsc-users mailing list