Additional Information ----- Make File --- VPATH usage problem

Additional Information ----- Make File --- VPATH usage problem

Post by Gaur » Sun, 10 Nov 2002 00:15:14


sorry i forgot to add my makefile earlier

**************** makefile ******************
VPATH = gsl
objects = deletethis.o matrix.o vector_ops.o utility.o symm.o
deletethis : $(objects)
        g++ -Igsl -o deletethis $(objects)
deletethis.o: deletethis.cpp gsl_eigen.h matrix.h
        g++ -Igsl -c deletethis.cpp
matrix.o : matrix.cpp matrix.h vector_ops.h
        g++ -Igsl -c matrix.cpp
vector_ops.o : vector_ops.cpp vector_ops.h
        g++ -Igsl -c vector_ops.cpp
utility.o : utility.cpp utility.h
        g++ -Igsl -c utility.cpp
symm.o : symm.c  gsl_math.h gsl_vector.h gsl_matrix.h gsl_linalg.h
        g++ -Igsl -c symm.c

Am i doing something wrong in here. i have a subdirectory named gsl
with some of the header and .c files.

Here is the output of running makefile
g++ -Igsl -c deletethis.cpp
g++ -Igsl -c matrix.cpp
g++ -Igsl -c vector_ops.cpp
g++ -Igsl -c utility.cpp
g++ -Igsl -c symm.c
g++ -Igsl -o deletethis deletethis.o matrix.o vector_ops.o utility.o
deletethis.o(.text+0x1b1):deletethis.cpp: undefined reference to
deletethis.o(.text+0x1be):deletethis.cpp: undefined reference to
deletethis.o(.text+0x22f):deletethis.cpp: undefined reference to
symm.o(.text+0x807):symm.c: undefined reference to `gsl_error'
symm.o(.text+0x847):symm.c: undefined reference to `gsl_error'
symm.o(.text+0x89b):symm.c: undefined reference to `gsl_error'
symm.o(.text+0x8eb):symm.c: undefined reference to `gsl_error'
symm.o(.text+0x9f7):symm.c: undefined reference to `gsl_error'
symm.o(.text+0xa33):symm.c: more undefined references to `gsl_error'
symm.o(.text+0xab8):symm.c: undefined reference to
symm.o(.text+0xad0):symm.c: undefined reference to
symm.o(.text+0xae8):symm.c: undefined reference to
symm.o(.text+0xafb):symm.c: undefined reference to
symm.o(.text+0xb12):symm.c: undefined reference to
symm.o(.text+0xc54):symm.c: undefined reference to
symm.o(.text+0xc67):symm.c: undefined reference to `gsl_vector_memcpy'
symm.o(.text$gsl_vector_set+0x2a):symm.c: undefined reference to
symm.o(.text$gsl_matrix_get+0x2a):symm.c: undefined reference to
symm.o(.text$gsl_matrix_get+0x5e):symm.c: undefined reference to
collect2: ld returned 1 exit status
make: *** [deletethis] Error 1

All of the .c files compiles but linker spits out some error messages.
Where am i wrong ?



1. Make File --- VPATH usage problem

Hello There,

I am using g++ compiler in UNIX.

I have a couple of .h and .c files that i am using from GNU-GSL
library. These files are stored in my program subdirectory called

I am using VPATH variable in makefile to make sure that subdirectory
is checked for files.
I am also using -Igsl in the CFLAGS for compiler.

The program compiles but there is a problem with the linker. Do i have
to specify somewhere in make file for the linker to know that some
files are in "gsl" subdirectory.

Thank you ,

2. fix .text.exit error in mtd/maps/pci.c

3. GNU Make: VPATH/vpath not re-examined after startup

4. Abiword compiling problems

5. file usage information

6. Decoding problem solved!

7. i8253 count additional information

8. What is iptables

9. Additional information on "Invisible cursor"

10. Apache 1.3.3 and Servlets additional information

11. Additional information: Connected, Inc.

12. rh9 2.5 kernel additional information

13. Additional Information in case of core dump