gpt4 book ai didi

c - 为什么 gcc 找不到 GSL?

转载 作者:太空宇宙 更新时间:2023-11-04 04:34:20 26 4
gpt4 key购买 nike

我正在使用其 header 需要 GSL 的 C 程序:

#include <gsl/gsl_rng.h>

还没有,我用 MacPorts 安装了它(所以我相信):

sudo port install gsl

看起来进展顺利:

--->  Fetching archive for gsl
---> Attempting to fetch gsl-1.16_3.darwin_14.x86_64.tbz2 from http://packages.macports.org/gsl
---> Attempting to fetch gsl-1.16_3.darwin_14.x86_64.tbz2.rmd160 from http://packages.macports.org/gsl
---> Installing gsl @1.16_3
---> Activating gsl @1.16_3
---> Cleaning gsl
---> Updating database of binaries
---> Scanning binaries for linking errors
---> No broken files found.

然而 GCC 仍然不知道 GSL 在哪里:

fatal error: 'gsl/gsl_rng.h' file not found 

出了什么问题? GSL 只是用错地方了吗?

这是在 OSX 10.10.2 上

最佳答案

我想您必须明确指定包含路径,即使用类似 -I/opt/local/include/ 的内容。此外,选项 -L/opt/local/lib 可能是链接所必需的,以便链接器可以找到库 libgsl

关于c - 为什么 gcc 找不到 GSL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32753634/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com