[petsc-users] Compile petsc with a simple code

Jianhua Qin njustqin at gmail.com
Wed Oct 23 14:15:39 CDT 2019


Thanks, Satish! It works now.

On Tue, Oct 22, 2019 at 12:05 AM Balay, Satish <balay at mcs.anl.gov> wrote:

> Try compiling a PETSc example with the corresponding PETSc makefile -
> to check the compile/link command that you need to use.
>
> Its best to use a PETSc formatted makefile for user code [check users
> manual for an example]
>
> Satish
>
> On Mon, 21 Oct 2019, Jianhua Qin via petsc-users wrote:
>
> > Hello everyone,
> >
> > I am new to petsc and trying to play with petsc. However, I met the
> problem
> > of linking petsc to my code. For example, I have a simple code named
> > hello.c which include petscvec,h, but I don't know how to include. I
> always
> > get the following error :
> >
> >
> > *hello.c:1:10: fatal error: petscvec.h: No such file or directory
> #include
> > <petscvec.h>*
> >
> > I compile with the following command:
> >
> > * gcc -L/home/lucky/Desktop/software/petsc-3.7.7/arch-linux2-c-debug/lib
> >  hello.c -o hello: *
> >
> > It would be best if any of you can give any suggestions.
> >
> > Best,
> > Jianhua
> >
>
> --
Jianhua
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20191023/7f2c68f8/attachment.html>


More information about the petsc-users mailing list