<meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8"><title></title><meta name="GENERATOR" content="OpenOffice.org 1.9.129 (Linux)"><meta name="CREATED" content="20060721;20232700"><meta name="CHANGED" content="20060721;20342200">
        
        
        
        
        <style>
        <!--
                @page { size: 8.5in 11in; margin: 0.79in }
                P { margin-bottom: 0.08in }
        -->
        </style>
<p style="margin-bottom: 0in;"><font face="Nimbus Roman No9 L"><font size="3">Satish,</font></font></p>
<p style="margin-bottom: 0in;"><font face="Nimbus Roman No9 L"><font size="3">Thank
you very much for your fast response. It has solved the problem with
including files and I can generate the object file for my class
(myclass.o).<br>
However,
I suppose that with</font></font></p>
<p style="margin-bottom: 0in;"><font face="Nimbus Roman No9 L"><font size="3">ex1:
myclass.o chkopts</font></font></p>
<pre> <font face="Nimbus Roman No9 L"><font size="3">-${CLINKER} -o ex1 myclass.o ${MY_LIB} ${PETSC_KSP_LIB}</font></font>
<font face="Nimbus Roman No9 L"><font size="3">${RM} myclass.o</font></font>
<font face="Nimbus Roman No9 L"><font size="3"><br>the makefile is trying to link a self executable program (ex1) and I obtain the following error message:</font></font></pre><p style="margin-bottom: 0in;">
<font face="Nimbus Roman No9 L"><font size="3">: undefined reference to
`main' </font></font>
</p><font face="Nimbus Roman No9 L"><font size="3">(in
myclass.cpp there is no main block, the class is used by main.cpp).</font></font>
<p style="margin-bottom: 0in;"><font face="Nimbus Roman No9 L"><font size="3">I
would like,</font></font></p>
<p style="margin-bottom: 0in;"><font face="Nimbus Roman No9 L"><font size="3">1-compile
the class and obtain the file myclass.o (now I can do it with the error
shown above, but the file is at least generated) taking into account
the
correct includes (from PETSc and from other libraries). I do not need
the libraries in this step<br>
2-compile
all the other classes not using PETSc and obtain the other files *.o<br>
3-link
all the files *.o and myclass.o taking into account all the libraries</font></font></p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;"><font face="Nimbus Roman No9 L"><font size="3">Thank
you very much. Best regards,</font></font></p>
<p style="margin-bottom: 0in;"><br>
</p>
<p style="margin-bottom: 0in;"><font face="Nimbus Roman No9 L"><font size="3">Jordi
Poblet</font></font></p>
<br><br><div><span class="gmail_quote">On 7/21/06, <b class="gmail_sendername">Satish Balay</b> <<a href="mailto:balay@mcs.anl.gov">balay@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;">
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 is<br>> written in C++). Some classes should use PETSc routines and routines from
<br>> other libraries. When compiling these classes, I have to include not 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 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 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></blockquote></div><br>