This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Linking error problem related to #includes


Hello

I have a program that uses gnu-gsl eigen value library.
Here is the file structure.

WORKING DIRECTORY CONSIST OF
*******************************
gsl - sub folder
deletethis.cpp (driver)
makefile
matrix.cpp
-----
-----
*******************************

gsl SUB DIRECTORY CONSISTS OF (3rd party library)
*******************************
gsl_block.h
gsl_block_complex_long_double.h
gsl_eigen.h
---
---
----
*******************************

deletethis.cpp (driver)
**************************
// deletethis.cpp : Defines the entry point for the console
application.
#include <gsl_eigen.h>  // third party library file
#include "matrix.h"    // file that i created
int main(int argc, char* argv[]){
---
--
}
***************************

gsl_eigen.h
**********************
#include <gsl_vector.h> //internally 3rd party library includes its
header files as <>
#include <gsl_matrix.h>
----
----
************************


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

************************

I am using I switch to make sure gsl sub folder is searched for header
files.
If i try to compile this program, i can get object files created but
there is problem with linking. Here is the output

*************************
$ make
g++ -Igsl -o deletethis.o -c deletethis.cpp
g++ -Igsl -o matrix.o -c matrix.cpp
g++ -Igsl -o vector_ops.o -c vector_ops.cpp
g++ -Igsl -o utility.o -c utility.cpp
g++ -Igsl -o qrstep.o -c qrstep.c
g++ -Igsl -o symm.o -c symm.c
g++ -Igsl deletethis.o matrix.o vector_ops.o utility.o symm.o qrstep.o
-o delete
this
deletethis.o(.text+0x17d):deletethis.cpp: undefined reference to
`_gsl_matrix_vi
ew_array'
deletethis.o(.text+0x18c):deletethis.cpp: undefined reference to
`_gsl_vector_al
loc'
deletethis.o(.text+0x21a):deletethis.cpp: undefined reference to
`_gsl_vector_ge
t'
symm.o(.text+0x5b7):symm.c: undefined reference to `_gsl_error'
symm.o(.text+0x5fc):symm.c: undefined reference to `_gsl_error'
symm.o(.text+0x649):symm.c: undefined reference to `_gsl_error'
symm.o(.text+0x693):symm.c: undefined reference to `_gsl_error'
symm.o(.text+0x7a0):symm.c: undefined reference to `_gsl_error'
symm.o(.text+0x7df):symm.c: more undefined references to `_gsl_error'
follow
symm.o(.text+0x875):symm.c: undefined reference to
`_gsl_vector_view_array'
symm.o(.text+0x892):symm.c: undefined reference to
`_gsl_vector_view_array'
symm.o(.text+0x8b2):symm.c: undefined reference to
`_gsl_vector_view_array'
symm.o(.text+0x8ca):symm.c: undefined reference to
`_gsl_linalg_symmtd_decomp'
symm.o(.text+0x8e3):symm.c: undefined reference to
`_gsl_linalg_symmtd_unpack_T'

symm.o(.text+0xa05):symm.c: undefined reference to
`_gsl_vector_view_array'
symm.o(.text+0xa1d):symm.c: undefined reference to
`_gsl_vector_memcpy'
symm.o(.text$gsl_vector_set+0x3d):symm.c: undefined reference to
`_gsl_error'
symm.o(.text$gsl_matrix_get+0x30):symm.c: undefined reference to
`_gsl_error'
symm.o(.text$gsl_matrix_get+0x66):symm.c: undefined reference to
`_gsl_error'
collect2: ld returned 1 exit status
make: *** [deletethis] Error 1
*********************************

Can someone tell me where i am going wrong. Sorry for the long post. I
tried being as concise as possible.

Thank you in advance.

Gaurav



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]