[bug-gsl] Re: unable to use gsl in MAC OS X (2008-10-17)
|
From: |
"Oliver Jennrich" <oliver.jennrich@..............> |
|
Subject: |
Re: unable to use gsl in MAC OS X |
|
Date: |
Fri, 17 Oct 2008 23:32:42 +0200 |
|
To: |
"Luis Borda de Agua" <lbagua@.........>, Bug-gsl@gnu.org |
|
Cc: |
|
On Fri, Oct 17, 2008 at 8:04 PM, Luis Borda de Agua <lbagua@.........> wrote:
> - This was the error message:
>
> Undefined symbols:
> "_gsl_sf_bessel_J0", referenced from:
> _main in ccnvBbbv.o
> ld: symbol(s) not found
> collect2: ld returned 1 exit status
>
> __________
>
> I realize that mac ports in fact installed the gsd in the directory
> /opt/local/include
> so I also tried
>
> $ gcc -Wall -I/opt/local/include asd.c
>
> but I got exactly the same error message. I then moved the gsl library to
> /usr/local/include
> and I got the error message described above.
Firstly, you need to tell gcc that you actually want to link with the
gsl. You do that with '-lgsl' (minus ell, *not* capital aye).
secondly, you need to tell gcc where to find the libraries. In your
case this is done via -L/opt/local/lib
So the complete command line looks like that:
gcc -o asd asd.c -Wall -I/opt/local/include -L/opt/local/lib -lgsl
--
Space -- the final frontier