Reputation: 75
I just updated to the newest OSX, El Capitan, and I am having problems with compiling a C program. It compiled fine just before the upgrade of the OS. After it I got a warning message already for my LaTeX text editor, Latexian:
But since I don't use preview or compilation inside the program and compile in the terminal with "latex file.tex" it works fine.
Now my problem is with my .c program which includes one of the GSL libraries, here is my header:
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
When compiling I get the following:
performance.c:4:10: fatal error: 'gsl/gsl_rng.h' file not found
#include <gsl/gsl_rng.h>
^
1 error generated.
I am guessing something changed in the OSX because of these two situations but the latter is a huge problem for me since I'm finishing my thesis! Hope my question is clear, it's my first.
EDIT:
And I'm guessing this is the problem
El Capitan's System Integrity Protection will shift utilities' functions
Upvotes: 5
Views: 10643
Reputation: 197
In my case this line solved this linking error
gcc $(gsl-config --cflags) name_of_file.c $(gsl-config --libs) -o name_of_file
See Wiki
Upvotes: 0
Reputation: 47563
When compiling with GCC you may have to manually specify the parent directory that contains the gsl
subfolder. Similarly you will have to specify the directory to find the libraries in as well. The include directory can be added as a search path to gcc with the -I
option, and the library search path with -L
. In your case that is done by adding this to your GCC compilation:
-I/usr/local/include -L/usr/local/lib
Upvotes: 4