当从包含源代码的目录运行时,ecpg可以很好地找到EXEC SQL包含头文件,但不能从任何其他目录中运行。
这里有一个插图。编译成功:
> ecpg -o dbconnect.c dbconnect.pgc缺少预期失败的include参数:
> cd ..
> ecpg -o src/dbconnect.c src/dbconnect.pgc
src/dbconnect.pgc:28: ERROR: could not open include file "vet_config.h" on line 28添加ecpg包含参数。仍然失败:
> ecpg -I src -o src/dbconnect.c src/dbconnect.pgc
src/dbconnect.pgc:28: ERROR: could not open include file "vet_config.h" on line 28我已经尝试指定src目录的绝对路径。没有改进。我知道-o是不必要的。
我使用的是PostgreSQL 9.2。以下是来自ecpg的版本信息:
> ecpg -v -I src -o src/dbconnect.c src/dbconnect.pgc
ecpg, the PostgreSQL embedded C preprocessor, version 4.8.0
EXEC SQL INCLUDE ... search starts here:
src
.
/usr/local/include
/usr/pgsql-9.2/include
/usr/include
end of search list发布于 2013-08-21 05:03:09
经过几天毫无结果的研究和调试代码的尝试,我终于在这个页面找到了答案:http://www.postgresql.org/docs/9.2/static/ecpg-preproc.html
我的整个问题是我把文件名括在双引号中。从文档中:
,但当使用EXEC SQL INCLUDE "filename“时,只搜索当前目录。
我去掉了双引号,一切都很好
https://stackoverflow.com/questions/17647090
复制相似问题