>>>>>> /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/../../../gcrt1.o: In function `_start': (.text+0x20): undefined reference to `main' /tmp/ccEthkOE.o: In function `solveMatrix': /home/mdbockman/Documents/Research/codes/quadrilateral_FEM/quad_FEM_svn_local/quad_FEM_svn/Debug/../SparseMatrixPetsc.c:22: undefined reference to `PetscInitialize' <<<<<<
Normally you get unresolved symbols when linking stuff in wrong order. i.e the order should be: SparseMatrixPetsc.o -lpetsc and not -lpetsc SparseMatrixPetsc.o Or its possible you've added the 'make getlinklib' info to the compile command - not link command. [assuming eclipse does the build in the above 2 steps.] Satish On Wed, 27 Jul 2011, Matt Bockman wrote: > I added the include directories from "make getincludedirs" and I added the > line from "make getlinklib". Eclipse creates a gcc call as follows: > > /home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/bin/mpicc > -I/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/include > -I/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/include > -I/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/include > -O0 -g3 -pg -p -Wall > -Wl,-rpath,/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/lib > -Wl,-rpath,/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/lib > -L/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/lib > -lpetsc -lX11 > -Wl,-rpath,/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/lib > -L/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/lib > -lflapack -lfblas -lnsl -lrt -lm > -L/home/mdbockman/Documents/Research/codes/petsc/petsc-3.1-p8/linux-gnu-c-debug/lib > -L/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2 > -L/usr/lib/x86_64-linux-gnu -ldl -lmpich -lpthread -lrt -lgcc_s -lmpichf90 > -lgfortran -lm -lm -ldl -lmpich -lpthread -lrt -lgcc_s -ldl -MMD -MP > -MF"SparseMatrixPetsc.d" -MT"SparseMatrixPetsc.d" -o"SparseMatrixPetsc.o" > "../SparseMatrixPetsc.c > > And when it is compiled I get the following: > > http://pastebin.com/CbRzYcZj > > The source file which is being compiled is: > > http://pastebin.com/Q85hXvnS > > Please have a look. I'm not quite sure what I'm doing wrong but I feel like > I'm getting closer and closer to the solution. > > Matt > > On Wed, Jul 27, 2011 at 11:52 AM, Satish Balay <balay at mcs.anl.gov> wrote: > > > use: > > make getincludedirs > > > > Satish > > > > On Wed, 27 Jul 2011, Mohammad Mirzadeh wrote: > > > > > I applogize for the mistake; Include files are actually located > > > in $PETSC_DIR/include > > > > > > On Wed, Jul 27, 2011 at 11:18 AM, Mohammad Mirzadeh <mirzadeh at gmail.com > > >wrote: > > > > > > > Ok then. Now I don't have enough experience with Eclipse so > > > > I apologize beforehand if you already know these/have tried them out. > > If > > > > not, hopefully they can be of help. I assume there should be a way in > > > > Eclipse to give it the link lib directory. In plain makefile that's > > just a > > > > simple step when linking. To get all the needed linklibs for petsc, you > > can > > > > do > > > > > > > > make getlinklibs > > > > > > > > in the $PETSC_DIR. As for the needed include files, they are all > > located > > > > in > > > > > > > > $PETSC_DIR/$PETSC_ARCH/include > > > > > > > > Again, its easy to use these directories along with your makefile. I'm > > not > > > > sure about how you give them to Eclipse though. Hopefully this has been > > > > helpful. > > > > > > > > Best, > > > > Mohammad > > > > > > > > > > > > > > > > > > > > On Wed, Jul 27, 2011 at 10:52 AM, Matt Bockman <mdbockma at ucsd.edu> > > wrote: > > > > > > > >> Just pointing it to the library would be sufficient. > > > >> > > > >> Matt > > > >> > > > >> > > > >> On Wed, Jul 27, 2011 at 10:21 AM, Mohammad Mirzadeh < > > mirzadeh at gmail.com>wrote: > > > >> > > > >>> So do you want to be able to compile PETSc with Eclipse or just point > > it > > > >>> to the library to use in your own applications? > > > >>> > > > >>> > > > >>> On Wed, Jul 27, 2011 at 9:14 AM, Matt Bockman <mdbockma at ucsd.edu> > > wrote: > > > >>> > > > >>>> Thanks Mohammad, > > > >>>> > > > >>>> I'll give that a shot. I use Qt Creator for some GUI applications so > > I > > > >>>> am familiar with it, but I've never tried doing a non-Qt project in > > it. I'd > > > >>>> really like to get Eclipse to work. > > > >>>> > > > >>>> Regarding the makefiles for eclipse. There are makefiles that it > > > >>>> generates (which are for GNU make) but I think I can also manually > > create my > > > >>>> makefiles. After sleeping on it, it seems like this might be the > > best > > > >>>> option, unless I can figure out a way to configure eclipse to > > include the > > > >>>> conf/variables and conf/rules files in the makefile. > > > >>>> > > > >>>> Matt > > > >>>> > > > >>>> > > > >>>> On Wed, Jul 27, 2011 at 12:01 AM, Mohammad Mirzadeh < > > mirzadeh at gmail.com > > > >>>> > wrote: > > > >>>> > > > >>>>> Although this is sort of orthogonal to what you do right now, > > > >>>>> I recommend Qt Creator as an alternative IDE to Eclipse. It links > > nicely > > > >>>>> with PETSc(or any other library for that matter) and has excellent > > c/c++ > > > >>>>> support. > > > >>>>> > > > >>>>> Mohammad > > > >>>>> > > > >>>>> > > > >>>>> On Tue, Jul 26, 2011 at 7:22 PM, Barry Smith <bsmith at mcs.anl.gov > > >wrote: > > > >>>>> > > > >>>>>> > > > >>>>>> There is a tiny bit of information in the PETSc users manual > > about > > > >>>>>> Eclipse: > > > >>>>>> > > > >>>>>> \section{Eclipse Users} \sindex{eclipse} > > > >>>>>> > > > >>>>>> If you are interested in developing code that uses PETSc from > > Eclipse > > > >>>>>> or developing PETSc in Eclipse and have knowledge of how to do > > indexing and > > > >>>>>> build libraries in Eclipse please contact us at \ > > > >>>>>> trl{petsc-dev at mcs.anl.gov}. > > > >>>>>> > > > >>>>>> To make PETSc an Eclipse package > > > >>>>>> \begin{itemize} > > > >>>>>> \item Install the Mecurial plugin for Eclipse and then import the > > > >>>>>> PETSc repository to Eclipse. > > > >>>>>> \item elected New->Convert to C/C++ project and selected shared > > > >>>>>> library. After this point you can perform searchs in the code. > > > >>>>>> \end{itemize} > > > >>>>>> > > > >>>>>> A PETSc user has provided the following steps to build an Eclipse > > > >>>>>> index for PETSc that can be used with their own code without > > compiling PETSc > > > >>>>>> source into their project. > > > >>>>>> \begin{itemize} > > > >>>>>> \item In the user project source directory, create a symlink to > > the > > > >>>>>> petsc/src directory. > > > >>>>>> \item Refresh the project explorer in Eclipse, so the new symlink > > is > > > >>>>>> followed. > > > >>>>>> \item Right-click on the project in the project explorer, and > > choose > > > >>>>>> "Index -> Rebuild". The index should now be build. > > > >>>>>> \item Right-click on the PETSc symlink in the project explorer, > > and > > > >>>>>> choose "Exclude from build..." to make sure Eclipse does not try > > to compile > > > >>>>>> PETSc with the project. > > > >>>>>> \end{itemize} > > > >>>>>> > > > >>>>>> We'd love to have someone figure out how to do it right and > > include > > > >>>>>> that information. > > > >>>>>> > > > >>>>>> Barry > > > >>>>>> > > > >>>>>> On Jul 26, 2011, at 4:32 PM, Matt Bockman wrote: > > > >>>>>> > > > >>>>>> > Has anyone gotten PETSc to work w/Eclipse? Eclipse nicely > > generates > > > >>>>>> all my makefiles for me for my current project (which is written > > in C++). > > > >>>>>> I'd like to link PETSc w/my application but I'm not sure how to do > > this. > > > >>>>>> > > > > >>>>>> > Suggestions? > > > >>>>>> > > > > >>>>>> > Thanks, > > > >>>>>> > Matt > > > >>>>>> > > > >>>>>> > > > >>>>> > > > >>>> > > > >>> > > > >> > > > > > > > > > > > >