我正在使用Oracle 10.2和AIX 5.2预编译包含Pro*C代码的C程序
Oracle预编译器读取$ORACLE_HOME/precomp/admin/pcscfg.cfg file
包含sys_include变量定义(设置为/usr/include
)的内容.
Pro*C编译器抱怨它不知道size_t
类型是什么,并且使用该size_t
类型的Oracle头文件报告错误.
这是在sqlcpr.h
文件上报告的示例错误:
extern void sqlglm( char*, size_t*, size_t* ); ...........................1 PCC-S-02201, Encountered the symbol "size_t" when expecting one of the following
size_t
stdio.h
在/usr/include
目录的头文件中定义.我包括stdio.h
我的头example.pc
文件之前包括我的sqlcpr.h
头.
我发出proc命令如下:
proc iname=example parse=full
我有什么想法我做错了吗?
来自Metalink
PCC-S-02201, Encountered the symbol "size_t" when expecting one of the following : ... auto, char, const, double, enum, float, int, long, ulong_varchar, OCIBFileLocator OCIBlobLocator, OCIClobLocator, OCIDateTime, OCIExtProcContext, OCIInterval, OCIRowid, OCIDate, OCINumber, OCIRaw, OCIString, register, short, signed, sql_context, sql_cursor, static, struct, union, unsigned, utext, uvarchar, varchar, void, volatile, a typedef name, exec oracle, exec oracle begin, exec, exec sql, exec sql begin, exec sql type, exec sql var, The symbol "enum," was substituted for "size_t" to continue. Syntax error at line 88, column 7, file /usr/include/gconv.h: Error at line 88, column 7 in file /usr/include/gconv.h size_t *);
解决方案描述
'sys_include'和'include'预编译器选项未正确设置. 在$ ORACLE_HOME/precomp/admin的pcscfg.cfg文件中设置'sys_include'和'include'预编译器选项,或在调用'proc'时在命令行中包含.
例如,以下是正确设置变量的推荐方法:
运行以下命令以获取编译器位置:
gcc -v
阅读/usr/lib/gcc-lib/i386-redhat-linux7/2.96/specs gcc版本2.96 20000731(Red Hat Linux 7.3 2.96-128)中的规范
使用上面返回的路径(删除规范并用include替换)
sys_include=($ORACLE_HOME/precomp/public, /usr/lib/gcc-lib/i386-redhat-linux7/2.96/include, /usr/include) include=(/u02/app/oracle/product/8.1.5/precomp/public) include=(/u02/app/oracle/product/8.1.5/rdbms/demo) include=(/u02/app/oracle/product/8.1.5/network/public) include=(/u02/app/oracle/product/8.1.5/plsql/public)
我猜测同时包含sysinclude和include的部分是你的问题.