[petsc-users] How to include PETSc in an Eclipse CDT project

Christian Staudt christian.staudt at ira.uka.de
Wed Apr 18 11:40:30 CDT 2012


Hello PETSc users,

I am new to PETSc (and, coming from the Java world, not an experienced C++ developer). I hope my question is appropriate on this list.

Here's my problem: I'd like to build an application in C++ against PETSc, using Eclipse CDT. However, I have problems including PETSc as a library in my Eclipse CDT project.


I have tried the following for my test project:

In Properties>>C/C++ Build>>Settings>>GCC C++ Compiler >> Includes I add the path

/usr/local/petsc/include/

In Properties>>C/C++ Build>>Settings>>MacOS X C++ Linker >> Libraries, I add 

/usr/local/petsc/arch-darwin-c-debug/lib/libpetsc.a 

to "Libraries (-l)" and

/usr/local/petsc/arch-darwin-c-debug/lib/

to "Library search path (-L)"



Now I try to build a simple Hello World program which has the lines

#include <petsc.h>
#include <petscmat.h>

at the beginning of the main file.

I get compiler errors for almost every line of the PETSc header files, indicating that basic types are not found, for example:

/usr/local/petsc/include/petscmat.h:1643: error: 'PetscScalar' has not been declared
/usr/local/petsc/include/petscmat.h:1721: error: 'PetscReal' has not been declared
/usr/local/petsc/include/petscmat.h:1152: error: 'PetscReal' does not name a type
...


Can anyone tell me what might be the problem? Thank you.

Chris





More information about the petsc-users mailing list