Hi Satish -<br><br>Thanks for your response. I think this helped me to realize that I was making things harder than they should be.<br><br>I've managed to get this working, and here are a few notes:<br><br>1. It was not clear to me why the Petsc-provided makefiles worked, because the compilation of the C code into a ".o" file is buried deep inside several makefiles (e.g. $PETSC_DIR/conf/rules) included in the original example makefile. So, I was trying to compile each of my ".cc" files into ".o" files manually, then link. In fact, all I had to do was let Petsc take care of compiling each ".cc" file into a ".o" file, and I only had to give the line to link the libraries to the driver.<br>
<br>2. The only major change I had to make to the example makefiles to get the driver to link and compile was to add ${PETSC_CC_INCLUDES} after ${CLINKER}, like this:<br><br>Laplace: Laplace.cc $(OBJ_FILES)<br> -${CLINKER} ${PETSC_CC_INCLUDES} Laplace.cc -o bin.x $(OBJ_FILES) ${PETSC_KSP_LIB}<br>
${RM} $(OBJ_FILES)<br><br>Otherwise there were some error messages related to header files.<br>
<br><br>Thanks again for your help.<br><br>Charles<br><br><div class="gmail_quote">2010/3/23 Satish Balay <span dir="ltr"><<a href="mailto:balay@mcs.anl.gov" target="_blank">balay@mcs.anl.gov</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
For one we recommend using the latest version i.e petsc-3.0.0 [or the<br>
upcoming petsc-3.1 - via petsc-dev] - but not this old version 2.3.3.<br>
<br>
Secondly - if you want to use PETSc from c++ - the recommended way is<br>
to build it with the configure option '--with-clanguage=cxx'<br>
<br>
And then [after making sure the examples work] use "petsc.h" without<br>
the "extern C" etc. in your code.<br>
<br>
If the examples compile fine - - but not your code - the issuse is<br>
usually the makefile [make it as close to a petsc makefile as possible<br>
- for eg: src/ksp/ksp/examples/tutorials/makefile].<br>
<font color="#888888"><br>
Satish<br>
</font><div><div></div><div><br>
On Tue, 23 Mar 2010, charles reid wrote:<br>
<br>
> (Please let me know if I can give any additional information that would be<br>
> helpful for this problem.)<br>
><br>
><br>
> I'm trying to use Petsc in an object-oriented C++ code, developing with g++<br>
> on Mac OS X 10.5, and I'm running into some problems in the linking stage.<br>
> I've defined an object that uses Petsc (what I'm calling the GmresSolver<br>
> class), and the object compiles just fine. However, when it comes time to<br>
> compile the driver (Laplace.cc) and link to Petsc libraries, I see a bunch<br>
> of "Undefined symbol" errors.<br>
><br>
> In my object code that uses Petsc (GmresSolver.h), I have included the Petsc<br>
> header file as:<br>
> extern "C" {<br>
> #include "petscksp.h"<br>
> }<br>
><br>
> In the driver (Laplace.cc), depending on how I include the Petsc header<br>
> file, I get different errors. If I include it like I do in GmresSolver.h,<br>
> extern "C" {<br>
> #include "petsc.h"<br>
> }<br>
><br>
> I get a whole slew of header file syntax errors (see postscript of email).<br>
> If I just include the header file,<br>
> #include "petsc.h"<br>
><br>
> then I get the undefined symbols problem (more below).<br>
><br>
><br>
> My configure line for Petsc is<br>
> Users/charles/pkg/petsc-2.3.3-p15/config/configure.py \<br>
> --prefix=$HOME/pkg/petsc-2.3.3-p15 \<br>
> --with-python \<br>
> --with-mpi=0 \<br>
> --with-debugging=1 \<br>
> PETSC_DIR=$HOME/pkg/petsc-2.3.3-p15<br>
><br>
><br>
><br>
> Here's my step-by-step to produce the error:<br>
><br>
> 1. Compile all non-Petsc object code<br>
><br>
> 2. Compile object code that uses Petsc using this command:<br>
><br>
> g++ -c -Wall -I. -I/Users/charles/pkg/petsc-2.3.3-p15<br>
> -I/Users/charles/pkg/petsc-2.3.3-p15/bmake/darwin9.5.0-c-opt<br>
> -I/Users/charles/pkg/petsc-2.3.3-p15/include ./GmresSolver.<br>
><br>
> (as mentioned, this works fine.)<br>
><br>
> 3. Compile the driver, "Laplace.cc", and link it to Petsc's libraries:<br>
><br>
> g++ \<br>
> -I/Users/charles/pkg/petsc-2.3.3-p15/ \<br>
> -I/Users/charles/pkg/petsc-2.3.3-p15/include \<br>
> -I/Users/charles/pkg/petsc-2.3.3-p15/include/mpiuni \<br>
> -I/Users/charles/pkg/petsc-2.3.3-p15/include/petsc \<br>
> -DPETSC_STATIC_INLINE="" \<br>
> Laplace.cc \<br>
> -L/Users/charles/pkg/petsc-2.3.3-p15 \<br>
> -L/Users/charles/pkg/petsc-2.3.3-p15/lib/darwin9.5.0-c-opt \<br>
> -lpetscts -lpetscsnes -lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc \<br>
> BoundaryConditionFactory.o BoundaryCondition.o Field.o FileIO.o<br>
> GmresSolver.o JacobiSolver.o Timer.o TimerFactory.o<br>
><br>
> (Note: I don't know why I need -DPETSC_STATIC_INLINE="", but I do, otherwise<br>
> I see a bunch of errors like "petsc-2.3.3-p15/include/petscviewer.h:117:<br>
> error: ‘PETSC_STATIC_INLINE’ does not name a type" - anyone know what that's<br>
> all about?)<br>
><br>
> This last compiler command gives the undefined symbols errors:<br>
><br>
> Undefined symbols:<br>
> "PetscOptionsGetReal(char const*, char const*, double*, PetscTruth*)",<br>
> referenced from:<br>
> PetscOptionsGetReal(char const*, double*, PetscTruth*)in ccPG7mg3.o<br>
> "_Petsc_MPI_Abort", referenced from:<br>
> _PetscMaxSum_Local in libpetsc.a(pinit.o)<br>
> _PetscADMax_Local in libpetsc.a(pinit.o)<br>
> _PetscADMin_Local in libpetsc.a(pinit.o)<br>
> _PetscSynchronizedFlush in libpetsc.a(mprint.o)<br>
> _PetscSynchronizedFlush in libpetsc.a(mprint.o)<br>
> _PetscOptionsCheckInitial_Private in libpetsc.a(init.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscError in libpetsc.a(err.o)<br>
> _PetscMallocDumpLog in libpetsc.a(mtr.o)<br>
> _PetscSequentialPhaseBegin_Private in libpetsc.a(mpiu.o)<br>
> _PetscSequentialPhaseEnd_Private in libpetsc.a(mpiu.o)<br>
> _PetscSignalHandler_Private in libpetsc.a(signal.o)<br>
> _PetscSignalHandler_Private in libpetsc.a(signal.o)<br>
> _PetscDefaultSignalHandler in libpetsc.a(signal.o)<br>
> _PetscMPIAbortErrorHandler in libpetsc.a(errstop.o)<br>
> _PetscDefaultFPTrap in libpetsc.a(fp.o)<br>
> "_Petsc_MPI_Comm_dup", referenced from:<br>
> _PetscFinalize in libpetsc.a(pinit.o)<br>
> _PetscSequentialPhaseBegin in libpetsc.a(mpiu.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> "_Petsc_MPI_Init", referenced from:<br>
> _PetscInitialize in libpetsc.a(pinit.o)<br>
> "PetscOptionsGetTruth(char const*, char const*, PetscTruth*,<br>
> PetscTruth*)", referenced from:<br>
> PetscOptionsGetTruth(char const*, PetscTruth*, PetscTruth*)in<br>
> ccPG7mg3.o<br>
> "PetscInitialize(int*, char***, char const*, char const*)", referenced<br>
> from:<br>
> PetscInitialize(int*, char***)in ccPG7mg3.o<br>
> _main in ccPG7mg3.o<br>
> "_MPIUNI_TMP", referenced from:<br>
> _MPIUNI_TMP$non_lazy_ptr in ccPG7mg3.o<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(pinit.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(mprint.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(init.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(options.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(plog.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(mpinit.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(err.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(mtr.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(mpiu.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(verboseinfo.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(adebug.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(binv.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(filev.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(eventLog.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(view.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(pdisplay.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(tagm.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(mpiuopen.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(draw.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(sysio.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(pbarrier.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(dupl.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(fretrieve.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(send.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(dscatter.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(petscvu.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(axis.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(random.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(drawv.o)<br>
> _MPIUNI_TMP$non_lazy_ptr in libpetsc.a(lg.o)<br>
> "PetscOptionsGetScalar(char const*, char const*, double*, PetscTruth*)",<br>
> referenced from:<br>
> PetscOptionsGetScalar(char const*, double*, PetscTruth*)in ccPG7mg3.o<br>
> "_Petsc_MPI_Keyval_create", referenced from:<br>
> _PetscViewerASCIIGetStdout in libpetsc.a(vcreatea.o)<br>
> _PetscViewerASCIIGetStderr in libpetsc.a(vcreatea.o)<br>
> _PetscViewerASCIIOpen in libpetsc.a(vcreatea.o)<br>
> _PetscSequentialPhaseBegin in libpetsc.a(mpiu.o)<br>
> _PETSC_VIEWER_BINARY_ in libpetsc.a(binv.o)<br>
> _PetscViewerDestroy_ASCII in libpetsc.a(filev.o)<br>
> _PetscCommGetNewTag in libpetsc.a(tagm.o)<br>
> _PetscCommGetNewTag in libpetsc.a(tagm.o)<br>
> _PetscCommGetNewTag in libpetsc.a(tagm.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> _PetscCommDestroy in libpetsc.a(tagm.o)<br>
> _PetscCommDestroy in libpetsc.a(tagm.o)<br>
> _PetscCommDestroy in libpetsc.a(tagm.o)<br>
> _PetscSharedTmp in libpetsc.a(fretrieve.o)<br>
> _PetscSharedWorkingDirectory in libpetsc.a(fretrieve.o)<br>
> _PETSC_VIEWER_SOCKET_ in libpetsc.a(send.o)<br>
> _PETSC_VIEWER_DRAW_ in libpetsc.a(drawv.o)<br>
> "_Petsc_MPI_Attr_delete", referenced from:<br>
> _PetscSequentialPhaseEnd in libpetsc.a(mpiu.o)<br>
> _PetscCommDestroy in libpetsc.a(tagm.o)<br>
> "_Petsc_MPI_Attr_get", referenced from:<br>
> _PetscViewerASCIIGetStdout in libpetsc.a(vcreatea.o)<br>
> _PetscViewerASCIIGetStderr in libpetsc.a(vcreatea.o)<br>
> _PetscViewerASCIIOpen in libpetsc.a(vcreatea.o)<br>
> _PetscViewerASCIIOpen in libpetsc.a(vcreatea.o)<br>
> _PetscSequentialPhaseEnd in libpetsc.a(mpiu.o)<br>
> _PETSC_VIEWER_BINARY_ in libpetsc.a(binv.o)<br>
> _PetscViewerDestroy_ASCII in libpetsc.a(filev.o)<br>
> _PetscCommGetNewTag in libpetsc.a(tagm.o)<br>
> _PetscCommGetNewTag in libpetsc.a(tagm.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> _PetscCommDestroy in libpetsc.a(tagm.o)<br>
> _PetscCommDestroy in libpetsc.a(tagm.o)<br>
> _PetscCommDestroy in libpetsc.a(tagm.o)<br>
> _PetscCommDestroy in libpetsc.a(tagm.o)<br>
> _PetscSharedTmp in libpetsc.a(fretrieve.o)<br>
> _PetscSharedWorkingDirectory in libpetsc.a(fretrieve.o)<br>
> _PETSC_VIEWER_SOCKET_ in libpetsc.a(send.o)<br>
> _PETSC_VIEWER_DRAW_ in libpetsc.a(drawv.o)<br>
> "_Petsc_MPI_Attr_put", referenced from:<br>
> _PetscViewerASCIIGetStdout in libpetsc.a(vcreatea.o)<br>
> _PetscViewerASCIIGetStderr in libpetsc.a(vcreatea.o)<br>
> _PetscViewerASCIIOpen in libpetsc.a(vcreatea.o)<br>
> _PetscViewerASCIIOpen in libpetsc.a(vcreatea.o)<br>
> _PetscSequentialPhaseBegin in libpetsc.a(mpiu.o)<br>
> _PETSC_VIEWER_BINARY_ in libpetsc.a(binv.o)<br>
> _PetscViewerDestroy_ASCII in libpetsc.a(filev.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> _PetscCommDuplicate in libpetsc.a(tagm.o)<br>
> _PetscSharedTmp in libpetsc.a(fretrieve.o)<br>
> _PetscSharedWorkingDirectory in libpetsc.a(fretrieve.o)<br>
> _PETSC_VIEWER_SOCKET_ in libpetsc.a(send.o)<br>
> _PETSC_VIEWER_DRAW_ in libpetsc.a(drawv.o)<br>
> "PetscOptionsGetString(char const*, char const*, char*, unsigned long,<br>
> PetscTruth*)", referenced from:<br>
> PetscOptionsGetString(char const*, char*, unsigned long,<br>
> PetscTruth*)in ccPG7mg3.o<br>
> "_Petsc_MPI_Finalize", referenced from:<br>
> _PetscFinalize in libpetsc.a(pinit.o)<br>
> _Petsc_MPI_DebuggerOnError in libpetsc.a(init.o)<br>
> _PetscAttachDebuggerErrorHandler in libpetsc.a(adebug.o)<br>
> "PetscOptionsGetRealArray(char const*, char const*, double*, int*,<br>
> PetscTruth*)", referenced from:<br>
> PetscOptionsGetRealArray(char const*, double*, int*, PetscTruth*)in<br>
> ccPG7mg3.o<br>
> "PetscOptionsGetInt(char const*, char const*, int*, PetscTruth*)",<br>
> referenced from:<br>
> PetscOptionsGetInt(char const*, int*, PetscTruth*)in ccPG7mg3.o<br>
> "PetscViewerCreate(int, _p_PetscViewer**)", referenced from:<br>
> PetscViewerCreate(_p_PetscViewer**) in ccPG7mg3.o<br>
> "_Petsc_MPI_Comm_free", referenced from:<br>
> _PetscFinalize in libpetsc.a(pinit.o)<br>
> _PetscSequentialPhaseEnd in libpetsc.a(mpiu.o)<br>
> _PetscCommDestroy in libpetsc.a(tagm.o)<br>
> "PetscFinalize()", referenced from:<br>
> _main in ccPG7mg3.o<br>
> "PetscOptionsHasName(char const*, char const*, PetscTruth*)", referenced<br>
> from:<br>
> PetscOptionsHasName(char const*, PetscTruth*)in ccPG7mg3.o<br>
> "PetscOptionsGetStringArray(char const*, char const*, char**, int*,<br>
> PetscTruth*)", referenced from:<br>
> PetscOptionsGetStringArray(char const*, char**, int*, PetscTruth*)in<br>
> ccPG7mg3.o<br>
> "_MPIUNI_Memcpy", referenced from:<br>
> _PetscMaxSum in libpetsc.a(pinit.o)<br>
> _PetscFinalize in libpetsc.a(pinit.o)<br>
> _PetscGlobalMax in libpetsc.a(pinit.o)<br>
> _PetscGlobalMin in libpetsc.a(pinit.o)<br>
> _PetscGlobalSum in libpetsc.a(pinit.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintSummary in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscLogPrintDetailed in libpetsc.a(plog.o)<br>
> _PetscIntView in libpetsc.a(err.o)<br>
> _PetscIntView in libpetsc.a(err.o)<br>
> _PetscIntView in libpetsc.a(err.o)<br>
> _PetscIntView in libpetsc.a(err.o)<br>
> _PetscRealView in libpetsc.a(err.o)<br>
> _PetscRealView in libpetsc.a(err.o)<br>
> _PetscRealView in libpetsc.a(err.o)<br>
> _PetscRealView in libpetsc.a(err.o)<br>
> _PetscScalarView in libpetsc.a(err.o)<br>
> _PetscScalarView in libpetsc.a(err.o)<br>
> _PetscScalarView in libpetsc.a(err.o)<br>
> _PetscScalarView in libpetsc.a(err.o)<br>
> _PetscSharedTmp in libpetsc.a(fretrieve.o)<br>
> _PetscSharedWorkingDirectory in libpetsc.a(fretrieve.o)<br>
> "_Petsc_MPI_Initialized", referenced from:<br>
> _PetscInitialize in libpetsc.a(pinit.o)<br>
> "PetscOptionsGetIntArray(char const*, char const*, int*, int*,<br>
> PetscTruth*)", referenced from:<br>
> PetscOptionsGetIntArray(char const*, int*, int*, PetscTruth*)in<br>
> ccPG7mg3.o<br>
> "PetscSequentialPhaseBegin(int, int)", referenced from:<br>
> PetscSequentialPhaseBegin(int) in ccPG7mg3.o<br>
> PetscSequentialPhaseBegin() in ccPG7mg3.o<br>
> "PetscSequentialPhaseEnd(int, int)", referenced from:<br>
> PetscSequentialPhaseEnd(int) in ccPG7mg3.o<br>
> PetscSequentialPhaseEnd() in ccPG7mg3.o<br>
> ld: symbol(s) not found<br>
> collect2: ld returned 1 exit status<br>
><br>
> Is this a problem with my libpetsc.a? Or is this problem because another<br>
> library is broken or not being linked to? Any insight into this problem<br>
> would be greatly appreciated. After several hours of trying to figure this<br>
> out I feel like I'm lost at sea.<br>
><br>
><br>
> Charles<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> Postscript:<br>
><br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscviewer.h: In function<br>
> ‘PetscErrorCode PetscViewerCreate(_p_PetscViewer**)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscviewer.h:117: error:<br>
> declaration of C function ‘PetscErrorCode<br>
> PetscViewerCreate(_p_PetscViewer**)’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscviewer.h:116: error:<br>
> previous declaration ‘PetscErrorCode PetscViewerCreate(MPI_Comm,<br>
> _p_PetscViewer**)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscviewer.h: In function<br>
> ‘PetscErrorCode PetscViewerCreate(_p_PetscViewer**)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscviewer.h:117: error: invalid<br>
> conversion from ‘int’ to ‘_p_PetscViewer**’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscviewer.h:117: error: too<br>
> many arguments to function ‘PetscErrorCode<br>
> PetscViewerCreate(_p_PetscViewer**)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscviewer.h:117: error: at this<br>
> point in file<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsHasName(const char*, PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:10: error:<br>
> declaration of C function ‘PetscErrorCode PetscOptionsHasName(const char*,<br>
> PetscTruth*)’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:9: error: previous<br>
> declaration ‘PetscErrorCode PetscOptionsHasName(const char*, const char*,<br>
> PetscTruth*)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsHasName(const char*, PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:10: error: cannot<br>
> convert ‘const char*’ to ‘PetscTruth*’ for argument ‘2’ to ‘PetscErrorCode<br>
> PetscOptionsHasName(const char*, PetscTruth*)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetInt(const char*, PetscInt*, PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:12: error:<br>
> declaration of C function ‘PetscErrorCode PetscOptionsGetInt(const char*,<br>
> PetscInt*, PetscTruth*)’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:11: error:<br>
> previous declaration ‘PetscErrorCode PetscOptionsGetInt(const char*, const<br>
> char*, PetscInt*, PetscTruth*)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetInt(const char*, PetscInt*, PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:12: error: cannot<br>
> convert ‘const char*’ to ‘PetscInt*’ for argument ‘2’ to ‘PetscErrorCode<br>
> PetscOptionsGetInt(const char*, PetscInt*, PetscTruth*)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetTruth(const char*, PetscTruth*,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:14: error:<br>
> declaration of C function ‘PetscErrorCode PetscOptionsGetTruth(const char*,<br>
> PetscTruth*, PetscTruth*)’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:13: error:<br>
> previous declaration ‘PetscErrorCode PetscOptionsGetTruth(const char*, const<br>
> char*, PetscTruth*, PetscTruth*)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetTruth(const char*, PetscTruth*,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:14: error: cannot<br>
> convert ‘const char*’ to ‘PetscTruth*’ for argument ‘2’ to ‘PetscErrorCode<br>
> PetscOptionsGetTruth(const char*, PetscTruth*, PetscTruth*)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetReal(const char*, PetscReal*, PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:16: error:<br>
> declaration of C function ‘PetscErrorCode PetscOptionsGetReal(const char*,<br>
> PetscReal*, PetscTruth*)’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:15: error:<br>
> previous declaration ‘PetscErrorCode PetscOptionsGetReal(const char*, const<br>
> char*, PetscReal*, PetscTruth*)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetReal(const char*, PetscReal*, PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:16: error: cannot<br>
> convert ‘const char*’ to ‘PetscReal*’ for argument ‘2’ to ‘PetscErrorCode<br>
> PetscOptionsGetReal(const char*, PetscReal*, PetscTruth*)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetScalar(const char*, PetscScalar*,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:18: error:<br>
> declaration of C function ‘PetscErrorCode PetscOptionsGetScalar(const char*,<br>
> PetscScalar*, PetscTruth*)’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:17: error:<br>
> previous declaration ‘PetscErrorCode PetscOptionsGetScalar(const char*,<br>
> const char*, PetscScalar*, PetscTruth*)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetScalar(const char*, PetscScalar*,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:18: error: cannot<br>
> convert ‘const char*’ to ‘PetscScalar*’ for argument ‘2’ to ‘PetscErrorCode<br>
> PetscOptionsGetScalar(const char*, PetscScalar*, PetscTruth*)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetIntArray(const char*, PetscInt*, PetscInt*,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:20: error:<br>
> declaration of C function ‘PetscErrorCode PetscOptionsGetIntArray(const<br>
> char*, PetscInt*, PetscInt*, PetscTruth*)’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:19: error:<br>
> previous declaration ‘PetscErrorCode PetscOptionsGetIntArray(const char*,<br>
> const char*, PetscInt*, PetscInt*, PetscTruth*)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetIntArray(const char*, PetscInt*, PetscInt*,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:20: error: cannot<br>
> convert ‘const char*’ to ‘PetscInt*’ for argument ‘2’ to ‘PetscErrorCode<br>
> PetscOptionsGetIntArray(const char*, PetscInt*, PetscInt*, PetscTruth*)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetRealArray(const char*, PetscReal*, PetscInt*,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:22: error:<br>
> declaration of C function ‘PetscErrorCode PetscOptionsGetRealArray(const<br>
> char*, PetscReal*, PetscInt*, PetscTruth*)’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:21: error:<br>
> previous declaration ‘PetscErrorCode PetscOptionsGetRealArray(const char*,<br>
> const char*, PetscReal*, PetscInt*, PetscTruth*)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetRealArray(const char*, PetscReal*, PetscInt*,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:22: error: cannot<br>
> convert ‘const char*’ to ‘PetscReal*’ for argument ‘2’ to ‘PetscErrorCode<br>
> PetscOptionsGetRealArray(const char*, PetscReal*, PetscInt*, PetscTruth*)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetString(const char*, char*, size_t,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:24: error:<br>
> declaration of C function ‘PetscErrorCode PetscOptionsGetString(const char*,<br>
> char*, size_t, PetscTruth*)’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:23: error:<br>
> previous declaration ‘PetscErrorCode PetscOptionsGetString(const char*,<br>
> const char*, char*, size_t, PetscTruth*)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetString(const char*, char*, size_t,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:24: error: invalid<br>
> conversion from ‘const char*’ to ‘char*’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:24: error: invalid<br>
> conversion from ‘char*’ to ‘size_t’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:24: error: invalid<br>
> conversion from ‘size_t’ to ‘PetscTruth*’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:24: error: too<br>
> many arguments to function ‘PetscErrorCode PetscOptionsGetString(const<br>
> char*, char*, size_t, PetscTruth*)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:24: error: at this<br>
> point in file<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetStringArray(const char*, char**, PetscInt*,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:26: error:<br>
> declaration of C function ‘PetscErrorCode PetscOptionsGetStringArray(const<br>
> char*, char**, PetscInt*, PetscTruth*)’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:25: error:<br>
> previous declaration ‘PetscErrorCode PetscOptionsGetStringArray(const char*,<br>
> const char*, char**, PetscInt*, PetscTruth*)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h: In function<br>
> ‘PetscErrorCode PetscOptionsGetStringArray(const char*, char**, PetscInt*,<br>
> PetscTruth*)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petscoptions.h:26: error: cannot<br>
> convert ‘const char*’ to ‘char**’ for argument ‘2’ to ‘PetscErrorCode<br>
> PetscOptionsGetStringArray(const char*, char**, PetscInt*, PetscTruth*)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h: In function<br>
> ‘PetscErrorCode PetscInitialize(int*, char***)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1160: error: declaration<br>
> of C function ‘PetscErrorCode PetscInitialize(int*, char***)’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1159: error: previous<br>
> declaration ‘PetscErrorCode PetscInitialize(int*, char***, const char*,<br>
> const char*)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h: In function<br>
> ‘PetscErrorCode PetscInitialize(int*, char***)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1160: error: too many<br>
> arguments to function ‘PetscErrorCode PetscInitialize(int*, char***)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1160: error: at this<br>
> point in file<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h: In function<br>
> ‘PetscErrorCode PetscSequentialPhaseBegin(MPI_Comm)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1347: error: declaration<br>
> of C function ‘PetscErrorCode PetscSequentialPhaseBegin(MPI_Comm)’ conflicts<br>
> with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1346: error: previous<br>
> declaration ‘PetscErrorCode PetscSequentialPhaseBegin(MPI_Comm,<br>
> PetscMPIInt)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h: In function<br>
> ‘PetscErrorCode PetscSequentialPhaseBegin(MPI_Comm)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1347: error: too many<br>
> arguments to function ‘PetscErrorCode PetscSequentialPhaseBegin(MPI_Comm)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1347: error: at this<br>
> point in file<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h: In function<br>
> ‘PetscErrorCode PetscSequentialPhaseBegin()’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1348: error: declaration<br>
> of C function ‘PetscErrorCode PetscSequentialPhaseBegin()’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1347: error: previous<br>
> declaration ‘PetscErrorCode PetscSequentialPhaseBegin(MPI_Comm)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h: In function<br>
> ‘PetscErrorCode PetscSequentialPhaseBegin(MPI_Comm)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1348: error: too many<br>
> arguments to function ‘PetscErrorCode PetscSequentialPhaseBegin()’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1348: error: at this<br>
> point in file<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h: In function<br>
> ‘PetscErrorCode PetscSequentialPhaseBegin(MPI_Comm)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1350: error: declaration<br>
> of C function ‘PetscErrorCode PetscSequentialPhaseEnd(MPI_Comm)’ conflicts<br>
> with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1349: error: previous<br>
> declaration ‘PetscErrorCode PetscSequentialPhaseEnd(MPI_Comm, PetscMPIInt)’<br>
> here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h: In function<br>
> ‘PetscErrorCode PetscSequentialPhaseEnd(MPI_Comm)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1350: error: too many<br>
> arguments to function ‘PetscErrorCode PetscSequentialPhaseEnd(MPI_Comm)’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1350: error: at this<br>
> point in file<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h: In function<br>
> ‘PetscErrorCode PetscSequentialPhaseEnd()’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1351: error: declaration<br>
> of C function ‘PetscErrorCode PetscSequentialPhaseEnd()’ conflicts with<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1350: error: previous<br>
> declaration ‘PetscErrorCode PetscSequentialPhaseEnd(MPI_Comm)’ here<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h: In function<br>
> ‘PetscErrorCode PetscSequentialPhaseEnd(MPI_Comm)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1351: error: too many<br>
> arguments to function ‘PetscErrorCode PetscSequentialPhaseEnd()’<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1351: error: at this<br>
> point in file<br>
> Laplace.cc: In function ‘int main(int, char**)’:<br>
> /Users/charles/pkg/petsc-2.3.3-p15/include/petsc.h:1160: error: too many<br>
> arguments to function ‘PetscErrorCode PetscInitialize(int*, char***)’<br>
> Laplace.cc:206: error: at this point in file<br>
><br>
><br>
> This last error doesn't even make sense, as it conforms to the usage<br>
> specified here (<br>
> <a href="http://www.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-dev/docs/manualpages/Sys/PetscInitialize.html" target="_blank">http://www.mcs.anl.gov/petsc/petsc-2/snapshots/petsc-dev/docs/manualpages/Sys/PetscInitialize.html</a><br>
> ).<br>
> </div></div></blockquote></div><br>