undefined reference

Achim Gädke Achim.Gaedke@physik.tu-darmstadt.de
Mon Sep 22 18:57:00 GMT 2003


Cheng Xing wrote:

> Well, I input gsl-config --lib, and get
> -L/usr/local/lib -lgsl -lgslcblas -lm
> So is that ok to compile with 'gcc filename -lgsl -lgslcblas -lm'?
> I did compile successfully this time, but got another warning message 
> when run the file a.out. It said:
> a.out: error while loading shared libraries: libgsl.so.0 : cannot open 
> shared object file: No such file or directory.
> But I did find this file in my usr/local/lib
>
> -Cheng


Ok, now add /usr/local/lib to the environment variable LD_LIBRARY_PATH, 
for bash it is

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

In order to add the additional library search path to the binary use the 
flag while compiling:

-Wl,-rpath=/usr/local/lib

Yours, Achim



More information about the Gsl-discuss mailing list