<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sat, Apr 2, 2016 at 5:20 PM, Josh Lo <span dir="ltr"><<a href="mailto:ysjosh.lo@gmail.com" target="_blank">ysjosh.lo@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I am trying to compile my main source code with module.</div><div>I need PETSc in both main code and module, so I include the header file in both.</div><div>it gives me some error when compiling.</div><div>The error is:</div><div><br></div>
<p><span>src/main.F:2.9:</span></p>
<p><span></span><br></p>
<p><span> use fmodule </span></p>
<p><span> 2</span></p>
<p><span>Error: Symbol 'mpi_source' at (1) conflicts with symbol from module 'fmodule', use-associated at (2)</span></p>
<p><span>/Users/XXXXXXX/Desktop/project/petsc/petsc_3.6.3_install/include/mpif.h:10:30:</span></p>
<p><span></span><br></p>
<p><span> PARAMETER (MPI_SOURCE=3,MPI_TAG=4,MPI_ERROR=5)</span></p>
<p><span> 1</span></p>
<div><span>Error:</span><span> Cannot change attributes of USE-associated symbol mpi_source at (1)</span></div><div><br></div><div><br></div><div><br></div><div><br></div><div>it goes on and on, most relates to MPI.</div><div><br></div><div>my main source code is like:</div><div><br></div><div>program main</div><div>USE fmodule</div><div>implicit none</div><div>#include "petsc/finclude/petsc.h"<br></div><div><br></div><div>.......</div><div><br></div><div><br></div><div>end program main</div><div><br></div><div>the module:</div><div><br></div><div>module fmodule</div><div>#include "petsc/finclude/petsc.h"<br></div><div> <br></div><div>......</div><div><br></div><div>end module fmodule</div><div><br></div><div>if the I don't include the header file in module, then it is no error,</div><div>but I do need petsc in my module.</div><div><br></div><div>How can I solve this problem?</div></div></blockquote><div><br></div><div><a href="http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/UsingFortran.html">http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/UsingFortran.html</a><br></div><div><br></div><div>Change the include.</div><div><br></div><div> Thanks</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Thanks,</div><div>Lo</div><div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div>
</div></div>