[petsc-users] Compile petsc with a simple code

Balay, Satish balay at mcs.anl.gov
Mon Oct 21 23:05:15 CDT 2019


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
> 



More information about the petsc-users mailing list