[petsc-users] How to run Petsc in Fortran

Matthew Knepley knepley at gmail.com
Mon Apr 29 06:05:30 CDT 2013


On Mon, Apr 29, 2013 at 5:58 AM, Sonya Blade <sonyablade2010 at hotmail.com>wrote:

> Dear All,
> I'm experiencing the difficulties with running the Petsc in Fortran
> Language, I'm using gfortran
> integrated in the CodeBlock editor. I've compiled/installed the Petsc ,
> Slepc and having no
> problems calling the Petsc/Slepc functions in C, it works perfectly.
>
> When it comes to using Petsc in Fortran I follow the instructions given in
> that article, especially the item 3
>
> http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Sys/UsingFortran.html
>
> but so far I couldn't succeed to run them succesfully in Fortran,  my main
> code is as follow:
>
> program main
> implicit none
> #include <finclude/petscsys.h>
> #include <finclude/petscvec.h>
> #include <finclude/petscvec.h90>
>
> PetscReal norm
>
> print *,"Hello World "
> end
>
> I've added all the related include folders to search path
> (Petsc_Dir\include\finclude etc..) and library
> file "libpetsc.a" which results after Petsc compilation, but still
> compiler complains about the
> "Error: Unclassifiable statement at (1)" PetscReal norm. Which means that
> compiler is unaware of type
> identifier PetscReal. What am I missing here ?
>
> Your help will be appreciated,
>

Are you sure that your compiler is preprocessing the file? You usually need
to name it *.F.

   Matt


> Regards,
>
>
>


-- 
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/20130429/eeae3305/attachment.html>


More information about the petsc-users mailing list