[petsc-dev] Example src/snes/tutorials/examples/ex15.c

Travis Austin austin at txcorp.com
Mon Apr 29 11:58:58 CDT 2013


Hi,

I've been trying to build/link src/snes/tutorials/examples/ex15.c for the case that I have defined 'clanguage' to
be C++ on the configure line.  I get the following error:

Undefined symbols for architecture x86_64:
  "SNESPicardComputeFunction(_p_SNES*, _p_Vec*, _p_Vec*, void*)", referenced from:
      _main in ex15.o
  "SNESPicardComputeJacobian(_p_SNES*, _p_Vec*, _p_Mat**, _p_Mat**, MatStructure*, void*)", referenced from:
      _main in ex15.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: [ex15] Error 1 (ignored)
/bin/rm -f ex15.o

The error appears related to name mangling and can be fixed if I add:

extern "C" {
   extern PetscErrorCode  SNESPicardComputeFunction(SNES,Vec,Vec,void*);
   extern PetscErrorCode  SNESPicardComputeJacobian(SNES,Vec,Mat*,Mat*,MatStructure*,void*);
}

to the top of src/snes/tutorials/examples/ex15.c.  Note that this error does not occur if building PETSc with default 
settings where the C compiler is used to build the library and the example.

Thanks,
Travis


===============================
Travis Austin, Ph.D
VP, Computational Mathematics
Tech-X Corporation
5621 Arapahoe Ave
Boulder, CO 80303
austin at txcorp.com
===============================



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20130429/84e86a5f/attachment.html>


More information about the petsc-dev mailing list