加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

如何将目录添加到C头包含路径?

发布时间:2020-12-16 05:43:55 所属栏目:百科 来源:网络整理
导读:我无法安装依赖于依赖pcre.h的程序的麻烦.我已经安装到/ opt / local / include,但是C编译器看不到它,因此给了我: error: pcre.h: No such file or directory 我已经通过编写一个试图包含它的hello world程序来证实这一点: #include pcre.h#include stdio.
我无法安装依赖于依赖pcre.h的程序的麻烦.我已经安装到/ opt / local / include,但是C编译器看不到它,因此给了我:

error: pcre.h: No such file or directory

我已经通过编写一个试图包含它的hello world程序来证实这一点:

#include <pcre.h>
#include <stdio.h>

int main(void)
{
    printf("hello,worldn");
    return 0;
}

除非我将路径指定为< / opt /local/include/pcre.hu0026gt ;. 我希望C编译器默认找到它,但我不知道这是在哪里配置的.选项卡完成没有显示任何HEADER_PATH环境变量,我找不到类似于XCode不是特定的任何东西.但是,我使用的是Mac OSX Snow Leopard,这样做有所不同.

解决方法

在命令行中使用-I / opt / local / include,或在环境中使用C_INCLUDE_PATH = / opt / local / include.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读