自动引用不同目录中的头文件

时间:2013-01-17 14:09:02

标签: c unix

我正在尝试在现有应用程序上运行一个名为crest的工具。我的第一个目标应用程序是Apache。输出(如下所示)表示找不到某些头文件。它们位于源文件夹中的其他目录中。其中一个是\ httpd-2.2.14 \ srclib \ apr \ include。我不想更改apache的源代码,因为我想对Apache中的大量文件运行此命令,然后将相同的技术应用于其他几个应用程序。

我的问题是:

1)我怎样才能这样做,只要找到这些引用的包含文件,它就会找到它们所在的正确目录并将使用它。我可以定义目录。有朋友提到了改变命令行输入或构建环境变量的事情吗?

其他想法/建议将不胜感激。

谢谢大家。

运行波峰的命令是: ../bin/crestc ../../httpd-2.2.14/server/request.c -dfs

我得到以下输出:

[root@localhost src]# ../bin/crestc ../../httpd-2.2.14/server/request.c -dfs
cp libcrest/libcrest.a ../lib
cp run_crest/run_crest ../bin
cp process_cfg/process_cfg ../bin
cp tools/print_execution ../bin
cp libcrest/crest.h ../include
cp libcrest/libcrest.a ../lib
cp run_crest/run_crest ../bin
cp process_cfg/process_cfg ../bin
cp tools/print_execution ../bin
cp libcrest/crest.h ../include
gcc -D_GNUCC -E -I../bin/../include -DCIL=1 ../../httpd-2.2.14/server/request.c -o ./request.i
../../httpd-2.2.14/server/request.c:28:25: error: apr_strings.h: No such file or directory
../../httpd-2.2.14/server/request.c:29:25: error: apr_file_io.h: No such file or directory
../../httpd-2.2.14/server/request.c:30:25: error: apr_fnmatch.h: No such file or directory
../../httpd-2.2.14/server/request.c:33:22: error: apr_want.h: No such file or directory
../../httpd-2.2.14/server/request.c:36:23: error: ap_config.h: No such file or directory
../../httpd-2.2.14/server/request.c:37:19: error: httpd.h: No such file or directory
../../httpd-2.2.14/server/request.c:38:25: error: http_config.h: No such file or directory
../../httpd-2.2.14/server/request.c:39:26: error: http_request.h: No such file or directory
../../httpd-2.2.14/server/request.c:40:23: error: http_core.h: No such file or directory
../../httpd-2.2.14/server/request.c:41:27: error: http_protocol.h: No such file or directory
../../httpd-2.2.14/server/request.c:42:22: error: http_log.h: No such file or directory
../../httpd-2.2.14/server/request.c:43:23: error: http_main.h: No such file or directory
../../httpd-2.2.14/server/request.c:44:25: error: util_filter.h: No such file or directory
../../httpd-2.2.14/server/request.c:45:26: error: util_charset.h: No such file or directory
../../httpd-2.2.14/server/request.c:46:25: error: util_script.h: No such file or directory
../../httpd-2.2.14/server/request.c:48:22: error: mod_core.h: No such file or directory
BRead 0 branches.
Read 0 nodes.
Wrote 0 branch edges.
[root@localhost src]#

1 个答案:

答案 0 :(得分:2)

您可以设置C_INCLUDE_PATH环境变量(使用:分隔多个路径):

 export C_INCLUDE_PATH=/path/to/include/files:/path/to/more/include/files