gpt4 book ai didi

c - GCC 发现错误包括

转载 作者:行者123 更新时间:2023-11-30 17:57:41 24 4
gpt4 key购买 nike

我正在尝试构建一个项目,该项目依赖于 Apache httpd。不幸的是,我已经并且需要 httpd 源位于/usr/includes 中,而该项目在 $(project)/common/includes 中为 httpd(不同版本!)提供了自己的 header 。 。我希望 gcc 从项目目录而不是/usr/includes 中获取 header ,但我担心即使我成功了,我也可能会错过/usr/includes 中的其他重要 header 。

关于如何做到这一点有什么想法吗?

编辑:Make 文件的相关部分如下所示:

CFLAGS = -Wall -O3 -fPIC -fomit-frame-pointer -I vm -D_GNU_SOURCE -I libs/common -D_64BITS
EXTFLAGS = -pthread
MAKESO = $(CC) -shared #-WBsymbolic

# later ...

all: createbin libneko neko std compiler libs

neko: bin/neko

# later ...

bin/neko: $(VM_OBJECTS)
${CC} ${CFLAGS} ${EXTFLAGS} -o $@ ${VM_OBJECTS} ${NEKOVM_FLAGS}
strip bin/neko

在执行这个“食谱”时,我得到:

In file included from /usr/include/httpd/httpd.h:43:0,
from mod_neko.h:20,
from mod_neko.c:17:
/usr/include/httpd/ap_config.h:25:17: fatal error: apr.h: No such file or directory

但它不应该使用/usr/include/httpd/httpd.h,因为有 <project> /libs/include/apache2/httpd.h

最佳答案

这里有关于 gcc includes search path 的信息

GCC looks in several different places for headers. On a normal Unix system, if you do not instruct it otherwise, it will look for headers requested with #include in:

 /usr/local/include
libdir/gcc/target/version/include
/usr/target/include
/usr/include

您可以使用 -Idir 命令行选项添加到此列表。 在默认目录之前按从左到右的顺序搜索所有由 -I 命名的目录

关于c - GCC 发现错误包括,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12699896/

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