undefined reference to

Satish Balay balay at mcs.anl.gov
Sun Aug 19 14:56:42 CDT 2007


sorry - forgot the attachment

satish

On Sun, 19 Aug 2007, Satish Balay wrote:

> What do you have for:
> 
> nm -ao mvec.o 
> 
> Also - sugest using the attached makefile.
> 
> Satish
> 
> 
> On Sun, 19 Aug 2007, Waad Subber wrote:
> 
> > Thanks for response
> > I removed the lines and I got the following output after executing the make file:
> > 
> > gfortran -c  -fPIC -Wall -Wno-unused-variable -g   -I/home/waad/soft/petsc-2.3.3-p4 -I/home/waad/soft/petsc-2.3.3-p4/bmake/linux-gnu-c-debug -I/home/waad/soft/petsc-2.3.3-p4/include  -I/home/waad/mpich2-install/include        -o pro.o pro.F
> > gfortran -fPIC -Wall -Wno-unused-variable -g   -o exe pro.o    -Wl,-rpath,/home/waad/soft/petsc-2.3.3-p4/lib/linux-gnu-c-debug -L/home/waad/soft/petsc-2.3.3-p4/lib/linux-gnu-c-debug -lpetscts -lpetscsnes -lpetscksp -lpetscdm -lpetscmat -lpetscvec -lpetsc        -L/usr/lib64 -lX11 -Wl,-rpath,/home/waad/mpich2-install/lib -L/home/waad/mpich2-install/lib -lmpich -lpthread -llapack -lblas -lm -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -Wl,-rpath,/lib/../lib64 -L/lib/../lib64 -Wl,-rpath,/usr/lib/../lib64 -L/usr/lib/../lib64 -ldl -lgcc_s -lgfortranbegin -lgfortran -lm -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -Wl,-rpath,/lib/../lib64 -Wl,-rpath,/usr/lib/../lib64 -lm  -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.1.2
> >  -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2 -Wl,-rpath,/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64 -Wl,-rpath,/lib/../lib64 -L/lib/../lib64 -Wl,-rpath,/usr/lib/../lib64 -L/usr/lib/../lib64 -ldl -lgcc_s -ldl 
> > pro.o: In function `MAIN__':
> > /home/waad/petsc_test/example1/solvetest/pro.F:38: undefined reference to `mvec_'
> > collect2: ld returned 1 exit status
> > make: [exe] Error 1 (ignored)
> > /bin/rm -f -f pro.o
> > 
> >  
> > 
> > Barry Smith <bsmith at mcs.anl.gov> wrote: 
> > 
> >  Not sure what the problem is, but 
> > you should remove the lines
> > > mvec.o: mvec.F                                                                                                        
> > >     mpif90 -c mvec.F  
> > you do not need them.
> > 
> >   Please send ALL the output when you run make exe after the change.
> > 
> >    Barry
> > 
> > 
> > 
> > On Sun, 19 Aug 2007, Waad Subber wrote:
> > 
> > > Hello everyone
> > > 
> > > I am calling a subroutine from my main program, and when I compile the code I get an error message  (undefined reference to 'mvec_') referring to the call statement in the main program. I have defined the subroutine as external in the main program using (external mvec), but the problem still unsolved ..! 
> > > 
> > > The makefile looks like:
> > > 
> > > OBJS= mvec.o
> > > CFLAGS        = 
> > > FFLAGS        = 
> > > CPPFLAGS        =
> > > FPPFLAGS        =
> > > 
> > > 
> > > include ${PETSC_DIR}/bmake/common/base
> > > 
> > > all: $(OBJS)
> > > 
> > > mvec.o: mvec.F
> > >     mpif90 -c mvec.F
> > > 
> > > exe: pro.o $(OBJS) 
> > >     -${FLINKER} -o exe pro.o $(OBJS)  ${PETSC_LIB}
> > >      ${RM} -f pro.o
> > > 
> > > include ${PETSC_DIR}/bmake/common/test
> > > 
> > > Can any one help me with this issue please ...!
> > > 
> > > Thanks
> > > 
> > > Waad
> > > 
> > >        
> > > ---------------------------------
> > > Park yourself in front of a world of choices in alternative vehicles.
> > > Visit the Yahoo! Auto Green Center.
> > 
> > 
> > 
> >        
> > ---------------------------------
> > Be a better Heartthrob. Get better relationship answers from someone who knows.
> > Yahoo! Answers - Check it out. 
> 
> 
-------------- next part --------------
CFLAGS	    = 
FFLAGS	    = 
CPPFLAGS    =
FPPFLAGS    =
CLEANFILES  = exe

include ${PETSC_DIR}/bmake/common/base

OBJS = pro.o mvec.o

all: exe

exe: ${OBJS}
	-${FLINKER} -o exe ${OBJS}  ${PETSC_LIB}

include ${PETSC_DIR}/bmake/common/test



More information about the petsc-users mailing list