undefined reference
Martin Jansche
jansche@ling.ohio-state.edu
Mon Sep 22 18:52:00 GMT 2003
On Mon, 22 Sep 2003, Cheng Xing wrote:
> Well, I input gsl-config --lib, and get
> -L/usr/local/lib -lgsl -lgslcblas -lm
So use precisely that.
> So is that ok to compile with 'gcc filename -lgsl -lgslcblas -lm'?
You just proved to yourself that it's not OK. You probably need a -L
or -R option for your linker. Why don't you use `gsl-config --libs`
or $(gsl-config --libs) on your command line? As in "gcc $(gsl-config
--cflags) myfile.c $(gsl-config --libs)".
> 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
And that's your dynamic linker telling you that /usr/local/lib is not
in your dynamic library path. Read up on configuring /etc/ld.so.conf
or setting LD_LIBRARY_PATH.
- mj
More information about the Gsl-discuss
mailing list