help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] GSL and XCode


From: David Rangel
Subject: [Help-gsl] GSL and XCode
Date: Thu, 25 Feb 2010 12:34:48 +0000

Dear GSL Users:

I am attempting to use the GSL library with OSX's IDE XCode.  I don't know
if this is the correct place to place such a question.

I am able to use the command line to compile the bessel function example
given in the documentation at:

http://www.gnu.org/software/gsl/manual/html_node/An-Example-Program.html

which is:

     #include <stdio.h>
     #include <gsl/gsl_sf_bessel.h>

     int
     main (void)
     {
       double x = 5.0;
       double y = gsl_sf_bessel_J0 (x);
       printf ("J0(%g) = %.18e\n", x, y);
       return 0;
     }

using the suggested compiling and linking commands:

 $ gcc -Wall -I/usr/local/include -c example.c
 $ gcc -L/usr/local/lib example.o -lgsl -lgslcblas -lm

It does not link correctly if I use the extension example.cpp which is added
by default in Xcode and  I get the following error if the extension .cpp is
used instead of .c:

Undefined symbols:
  "___gxx_personality_v0", referenced from:
      ___gxx_personality_v0$non_lazy_ptr in example.o
ld: symbol(s) not found
collect2: ld returned 1 exit status


If I try to compile using XCode with the header search path set to
/usr/local/include and library search path to /usr/local/lib where the gsl
libraries are installed, I receive the following error during the linking
stage:

"_gsl_sf_bessel_J0", referenced from:
      _main in main.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

I also get the following warnings:

ld: warning in /Developer/SDKs/MacOSX10.5.sdk/usr/local/lib/libgsl.dylib,
file is not of required architecture
ld: warning in
/Developer/SDKs/MacOSX10.5.sdk/usr/local/lib/libgslcblas.dylib, file is not
of required architecture

I have tried switching the compiler from default to C ANSI but this does not
solve the problem.  I have tried renaming the file with the .c extension.
None of these helps eliminate the linking problem I searched on the web for
a solution to this problem, but cannot find a definitive answer.

I was wondering if this is the correct place to pose this question, and if
so, if anyone has experience using GSL with XCode and what is required to
make it work.

Thank you for your time and input.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]