does PETSC use template?

Matthew Knepley knepley at gmail.com
Sat Oct 28 08:40:22 CDT 2006


On 10/28/06, Yixun Liu <yxliu at fudan.edu.cn> wrote:
>
>
> Hi,
>
> Does PETSC use template? I think it does not use it because it implements
> with c. But, why vc++ compiler generate the error "error C2894: templates
> cannot be declared to have 'C' linkage" when I write the code as,

PETSc has C and C++. You should not use this construction to get C linkage
for PETSc. If you configured using --with-clanguage=c it already is, and if you
used --with-clanguage=c++ you need to add --with-c-support.

> #ifdef __cplusplus
> extern "C"{
> #endif
>
> #include <petsc.h>
> #include <petscmat.h>
> #include <petscvec.h>
> #include <petscksp.h>
>
>
> #ifdef __cplusplus
> }
> #endif

    Matt

> Best,
>
> Yixun
>


-- 
"Failure has a thousand explanations. Success doesn't need one" -- Sir
Alec Guiness




More information about the petsc-users mailing list