“gsl / gsl_rng。在OSX El Capitan升级后没有找到h文件

时间:2021-05-04 15:05:41

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:

我刚刚更新了最新的OSX, El Capitan,我在编译C程序时遇到了问题。它在OS升级之前编译得很好。之后,我收到了一条警告信息,是给我的乳胶文本编辑器Latexian:

Latexian message

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:

现在我的问题是我的。c程序包括一个GSL库,这是我的标题:

#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.

我猜OSX因为这两种情况发生了变化,但是后者对我来说是一个很大的问题,因为我要完成我的论文!希望我的问题是清楚的,这是我的第一个问题。

EDIT:

编辑:

And I'm guessing this is the problem

我猜这就是问题所在。

El Capitan's System Integrity Protection will shift utilities' functions

El Capitan的系统完整性保护将改变公用事业的功能。

2 个解决方案

#1


3  

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:

使用GCC编译时,您可能需要手动指定包含gsl子文件夹的父目录。类似地,您还必须指定目录来查找库。包含目录可以作为搜索路径添加到gcc,使用-I选项,使用-L的库搜索路径。在您的案例中,将此添加到GCC编译中:

-I/usr/local/include -L/usr/local/lib

#2


0  

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

看到维基

#1


3  

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:

使用GCC编译时,您可能需要手动指定包含gsl子文件夹的父目录。类似地,您还必须指定目录来查找库。包含目录可以作为搜索路径添加到gcc,使用-I选项,使用-L的库搜索路径。在您的案例中,将此添加到GCC编译中:

-I/usr/local/include -L/usr/local/lib

#2


0  

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

看到维基