help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] GSL and XCode


From: Jonny Taylor
Subject: Re: [Help-gsl] GSL and XCode
Date: Thu, 25 Feb 2010 12:43:48 +0000

David,

You should be able to solve your first problem by using g++ instead of gcc (or 
add -lstdc++). It's not immediately obvious to me why your code is being 
compiled as c++ code, but that appears to be the case.

As for your second problem I wonder if your project is compiling to a 64 bit 
(or universal) binary. Can you post the full Xcode build log showing the 
command line options it's using? If it's working from the command line but not 
from Xcode, the think to do is often to take the Xcode command line from the 
log and start stripping bits out to make it look like your direct command line 
invocation, until it starts working again. That gives you an idea of where the 
problem is coming in...

Hope this helps
Jonny

On 25 Feb 2010, at 12:34, David Rangel wrote:

> 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.
> _______________________________________________
> Help-gsl mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-gsl





reply via email to

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