<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8"><title></title><meta name="GENERATOR" content="OpenOffice.org 2.0-pre (Linux)"><meta name="CREATED" content="20060724;16294600"><meta name="CHANGED" content="20060724;16314000">
        
        
        
        
        <style>
        <!--
                @page { size: 21cm 29.7cm; margin: 2cm }
                P { margin-bottom: 0.21cm }
        -->
        </style>
<p style="margin-bottom: 0cm;">Barry and Satish,</p>
<p style="margin-bottom: 0cm;">Than you very much for your useful answers. I finally can compile the code using both types of
makefiles.</p>
<p style="margin-bottom: 0cm;">Best regards,</p>
<p style="margin-bottom: 0cm;">Jordi Poblet<br>
</p>
<br><br><div><span class="gmail_quote">On 7/21/06, <b class="gmail_sendername">Barry Smith</b> <<a href="mailto:bsmith@mcs.anl.gov">bsmith@mcs.anl.gov</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br> Jordi,<br><br> If you want to provide the rules to compile your code you<br>can instead just include bmake/common/variables this sets the variables<br>like ${PETSC_KSP_LIB} but you provide the rules for compiling.
<br><br> Satish,<br><br> Do we have written down somewhere on the website for the two<br>ways of using PETSc makefiles? There should be the directions (that only<br>you know :-). Maybe in the FAQ?<br><br> Barry<br>
<br><br>On Fri, 21 Jul 2006, jordi poblet wrote:<br><br>> Satish,<br>><br>> Thank you very much for your fast response. It has solved the problem with<br>> including files and I can generate the object file for my class (
myclass.o).<br>> However, I suppose that with<br>><br>> ex1: myclass.o chkopts<br>><br>> -${CLINKER} -o ex1 myclass.o ${MY_LIB} ${PETSC_KSP_LIB}<br>> ${RM} myclass.o<br>> the makefile is trying to link a self executable program (ex1) and I
<br>> obtain the following error message:<br>><br>> : undefined reference to `main'<br>> (in myclass.cpp there is no main block, the class is used by main.cpp).<br>><br>> I would like,<br>><br>> 1-compile the class and obtain the file
myclass.o (now I can do it with the<br>> error shown above, but the file is at least generated) taking into account<br>> the correct includes (from PETSc and from other libraries). I do not need<br>> the libraries in this step
<br>> 2-compile all the other classes not using PETSc and obtain the other files<br>> *.o<br>> 3-link all the files *.o and myclass.o taking into account all the libraries<br>><br>><br>> Thank you very much. Best regards,
<br>><br>><br>> Jordi Poblet<br>><br>><br>> On 7/21/06, Satish Balay <<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>> wrote:<br>>><br>>> The basic form of a PETSc makefile is as follows:
<br>>><br>>> >>>>>><br>>> CFLAGS =<br>>> FFLAGS =<br>>> CPPFLAGS =<br>>> FPPFLAGS =<br>>> CLEANFILES =<br>>><br>>> include ${PETSC_DIR}/bmake/common/base
<br>>><br>>> ex1: ex1.o chkopts<br>>> -${CLINKER} -o ex1 ex1.o ${PETSC_KSP_LIB}<br>>> ${RM} ex1.o<br>>> >>>>>>>>>><br>>><br>>><br>>> If you wish to specify additonal libraries - you can do it as:
<br>>><br>>><br>>> >>>>>>><br>>> MY_INC = -I/my/include<br>>> MY_LIB = -L/my/lib -lmy<br>>><br>>> CFLAGS =<br>>> FFLAGS =
<br>>> CPPFLAGS = ${MY_INC}<br>>> FPPFLAGS =<br>>> CLEANFILES =<br>>><br>>> include ${PETSC_DIR}/bmake/common/base<br>>><br>>> ex1: ex1.o chkopts<br>>> -${CLINKER} -o ex1
ex1.o ${MY_LIB} ${PETSC_KSP_LIB}<br>>> ${RM} ex1.o<br>>> >>>>>>>>><br>>><br>>> Also - you should make sure this library is compiled with the same<br>>> compilers as PETSc is compiled with.
<br>>><br>>> Satish<br>>><br>>> On Fri, 21 Jul 2006, jordi poblet wrote:<br>>><br>>> > Dear all,<br>>> ><br>>> > I would like to use PETSc within a finite element program (the main part
<br>>> is<br>>> > written in C++). Some classes should use PETSc routines and routines<br>>> from<br>>> > other libraries. When compiling these classes, I have to include not<br>>> only
<br>>> > the header files from PETSc (which in the examples of a single C or C++<br>>> > files are included automatically with the sample makefiles provided in<br>>> the<br>>> > manual) but also header files from the other used libraries. Finally, I
<br>>> > would have also to link PETSc with other libraries at the same time.<br>>> > I have tried to construct a makefile including 'by hand' the PETSc<br>>> headers<br>>> > but I have always problems. Could someone help me? Have you got makefile
<br>>> > examples for this situation (or similar)?<br>>> ><br>>> > The compilation options for the PETSc library that I have employed are:<br>>> ><br>>> > ./config/configure.py --with-mpi=0 --with-clanguage=c++
<br>>> > --with-scalar-type=complex<br>>> ><br>>> > tests and examples are passed correctly.<br>>> ><br>>> > I am running PETSc in linux machines.<br>>> ><br>>> >
<br>>> > Thank you in advance,<br>>> ><br>>> > Jordi Poblet<br>>> ><br>>><br>>><br>><br><br></blockquote></div><br>