ZeroLink: unknown symbol ' '

boyfarrell

Registered
Hi everybody,

I got this error at run time when calling a function from GNU Scientific Library. It compiles prefectly.

Code:
//GNU Scientific Library
#import <gsl/gsl_math.h>
#import <gsl/gsl_sf_trig.h>
int main(int argc, char *argv[])
{
	double x = 710.0;
	double y = 0.0;
	y = gsl_sf_lnsinh(x);
	printf("gsl_sf_lnsinh(%lf) = %lf", x, y);
	return 0;
   // return NSApplicationMain(argc,  (const char **) argv);
}

Any ideas?

Daniel.
 
Turn off ZeroLink and rebuild your project. Your run time error should become a link error. The usual cause of link errors is Xcode not being able to find a library or header file. Your #import statements look OK, and I'll assume you have added the GSL library to your project. You most likely need to add search paths for the GSL library to your project. There's a Search Paths collection of build settings in Xcode. From there you can add search paths for headers, libraries, and frameworks.
 
Indeed it does become a link error. The search string '/opt/local/include' (without the inverted commas) is already added.

Could be a problem with in install of GSL. However Darwinports didn't throw out any error messages...?
 
You need to add the /opt/local/lib directory so that the linker knows where to look for additional libraries. I can't remember the exact linker field to add it too, and if all else fails, just add "-L/opt/local/lib" to the field additional LDFLAGS. That's what I usually do :).
 
Hi,

Ignore the below the edit.

EDIT ---

After messing around a bit longer I got it to work:
Header Search Path = opt/local/include
Library Search Path = opt/local/lib
Other Linker Flags = -lgsl (here you can add the other linkers such as -lgslcblas etc...)

EDIT ---

I've added -L/opt/local/lib to the OTHER_LDFLAGS field, I can't find the LDFLAGS field. I went to Project --> Edit Project Settings to do that. After cleaning and building I get the same result? Does the format of the string matter in the information panel of Library Search Paths it seems to specify [/opt/local/lib, -L] format? I entered the same path into the library search path too and it can't find the files it needs. What am I doing wrong?
 
Back
Top