On Wed, Mar 24, 2010 at 3:02 AM, charles reid <span dir="ltr"><<a href="mailto:charlesreid1@gmail.com">charlesreid1@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
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></blockquote><div><br></div><div>Alternatively</div><div><br></div><div>Laplace: Laplace.o $(OBJ_FILES)<br> -${CLINKER} -o bin.x Laplace.o $(OBJ_FILES) ${PETSC_KSP_LIB}<br> ${RM} $(OBJ_FILES)<br>
</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Otherwise there were some error messages related to header files.<br>
<br><br>Thanks again for your help.<br><br>Charles<br><br></blockquote></div>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>
-- Norbert Wiener<br>