linux下基于oracle pro*c开发,打好环境 写了个测试代码,执行proc hello.pc时出现了如下这样一类错误:
PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "auto," was substituted for "__gnuc_va_list" to continue. Syntax error at line 467, column 35, file /usr/include/libio.h: Error at line 467, column 35 in file /usr/include/libio.h extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, ..................................1 PCC-S-02201, Encountered the symbol "*" when expecting one of the following: , ) Syntax error at line 468, column 5, file /usr/include/libio.h: Error at line 468, column 5 in file /usr/include/libio.h _IO_va_list); ....1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "auto," was substituted for "__gnuc_va_list" to continue. Syntax error at line 469, column 39, file /usr/include/libio.h: Error at line 469, column 39 in file /usr/include/libio.h extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t); ......................................1 PCC-S-02201, Encountered the symbol "*" when expecting one of the following: , ) Syntax error at line 470, column 19, file /usr/include/libio.h: Error at line 470, column 19 in file /usr/include/libio.h extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t); ..................1 PCC-S-02201, Encountered the symbol "_IO_sgetn" when expecting one of the follow ing: ; , = ( [ The symbol "=" was substituted for "_IO_sgetn" to continue. Syntax error at line 470, column 40, file /usr/include/libio.h: Error at line 470, column 40 in file /usr/include/libio.h extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t); .......................................1 PCC-S-02201, Encountered the symbol "," when expecting one of the following: ( * & + - ~ ! ^ ++ -- ... sizeof, an identifier, a quoted string, a numeric constant, The symbol "..." was substituted for "," to continue. Syntax error at line 472, column 42, file /usr/include/libio.h: Error at line 472, column 42 in file /usr/include/libio.h extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int); .........................................1 PCC-S-02201, Encountered the symbol "*" when expecting one of the following: , ) Syntax error at line 473, column 42, file /usr/include/libio.h: Error at line 473, column 42 in file /usr/include/libio.h extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int); .........................................1 PCC-S-02201, Encountered the symbol "*" when expecting one of the following: , ) Error at line 83, column 12 in file /usr/include/stdio.h # include <stdarg.h> ...........1 PCC-S-02015, unable to open include file Syntax error at line 475, column 44, file /usr/include/libio.h: Error at line 475, column 44 in file /usr/include/libio.h extern void _IO_free_backup_area (_IO_FILE *) __THROW; ...........................................1 PCC-S-02201, Encountered the symbol "*" when expecting one of the following: , ) Syntax error at line 319, column 35, file /usr/include/stdio.h: Error at line 319, column 35 in file /usr/include/stdio.h extern FILE *fmemopen (void *__s, size_t __len, const char *__modes) ..................................1 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 325, column 47, file /usr/include/stdio.h: Error at line 325, column 47 in file /usr/include/stdio.h extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur; ..............................................1 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 337, column 20, file /usr/include/stdio.h: Error at line 337, column 20 in file /usr/include/stdio.h int __modes, size_t __n) __THROW; ...................1 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 344, column 10, file /usr/include/stdio.h: Error at line 344, column 10 in file /usr/include/stdio.h size_t __size) __THROW; .........1 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 372, column 8, file /usr/include/stdio.h: Error at line 372, column 8 in file /usr/include/stdio.h _G_va_list __arg); .......1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "__gnuc_va_list" to continue. Syntax error at line 377, column 54, file /usr/include/stdio.h: Error at line 377, column 54 in file /usr/include/stdio.h extern int vprintf (const char *__restrict __format, _G_va_list __arg); .....................................................1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "__gnuc_va_list" to continue. Syntax error at line 380, column 8, file /usr/include/stdio.h: Error at line 380, column 8 in file /usr/include/stdio.h _G_va_list __arg) __THROWNL; .......1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "__gnuc_va_list" to continue. Syntax error at line 386, column 44, file /usr/include/stdio.h: Error at line 386, column 44 in file /usr/include/stdio.h extern int snprintf (char *__restrict __s, size_t __maxlen, ...........................................1 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 390, column 45, file /usr/include/stdio.h: Error at line 390, column 45 in file /usr/include/stdio.h extern int vsnprintf (char *__restrict __s, size_t __maxlen, ............................................1 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 391, column 42, file /usr/include/stdio.h: Error at line 391, column 42 in file /usr/include/stdio.h const char *__restrict __format, _G_va_list __arg) .........................................1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "__gnuc_va_list" to continue. Syntax error at line 413, column 8, file /usr/include/stdio.h: Error at line 413, column 8 in file /usr/include/stdio.h _G_va_list __arg) .......1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "__gnuc_va_list" to continue. Syntax error at line 472, column 7, file /usr/include/stdio.h: Error at line 472, column 7 in file /usr/include/stdio.h _G_va_list __arg) ......1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "__gnuc_va_list" to continue. Syntax error at line 479, column 53, file /usr/include/stdio.h: Error at line 479, column 53 in file /usr/include/stdio.h extern int vscanf (const char *__restrict __format, _G_va_list __arg) ....................................................1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "__gnuc_va_list" to continue. Syntax error at line 484, column 40, file /usr/include/stdio.h: Error at line 484, column 40 in file /usr/include/stdio.h const char *__restrict __format, _G_va_list __arg) .......................................1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "__gnuc_va_list" to continue. Syntax error at line 510, column 9, file /usr/include/stdio.h: Error at line 510, column 9 in file /usr/include/stdio.h _G_va_list __arg) __wur; ........1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "__gnuc_va_list" to continue. Syntax error at line 512, column 8, file /usr/include/stdio.h: Error at line 512, column 8 in file /usr/include/stdio.h _G_va_list __arg) __wur; .......1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "__gnuc_va_list" to continue. Syntax error at line 515, column 9, file /usr/include/stdio.h: Error at line 515, column 9 in file /usr/include/stdio.h _G_va_list __arg) __THROW; ........1 PCC-S-02201, Encountered the symbol "__gnuc_va_list" when expecting one of the f ollowing: ... 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 "__gnuc_va_list" to continue. Syntax error at line 666, column 11, file /usr/include/stdio.h: Error at line 666, column 11 in file /usr/include/stdio.h size_t *__restrict __n, int __delimiter, ..........1 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 669, column 9, file /usr/include/stdio.h: Error at line 669, column 9 in file /usr/include/stdio.h size_t *__restrict __n, int __delimiter, ........1 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 679, column 8, file /usr/include/stdio.h: Error at line 679, column 8 in file /usr/include/stdio.h size_t *__restrict __n, .......1 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 709, column 15, file /usr/include/stdio.h: Error at line 709, column 15 in file /usr/include/stdio.h extern size_t fread (void *__restrict __ptr, size_t __size, ..............1 PCC-S-02201, Encountered the symbol "fread" when expecting one of the following: ; , = ( [ The symbol ";" was substituted for "fread" to continue. Syntax error at line 709, column 46, file /usr/include/stdio.h: Error at line 709, column 46 in file /usr/include/stdio.h extern size_t fread (void *__restrict __ptr, size_t __size, .............................................1 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 "exec," was substituted for "size_t" to continue. Syntax error at line 715, column 1, file /usr/include/stdio.h: Error at line 715, column 1 in file /usr/include/stdio.h extern size_t fwrite (const void *__restrict __ptr, size_t __size, 1 PCC-S-02201, Encountered the symbol "extern" when expecting one of the following : , ) Error at line 0, column 0 in file hello.pc PCC-F-02102, Fatal error while doing C preprocessing由于预处理程序配置(/.../precomp/admin/pcscfg.cfc)错误,无法找到正确的头文件.
查看stddef.h文件位置:
[~]$ locate stddef.h /usr/include/linux/stddef.h /usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/stddef.h /usr/share/man/man0p/stddef.h.0p.gz /usr/src/kernels/3.10.0-1127.19.1.el7.x86_64/include/linux/stddef.h /usr/src/kernels/3.10.0-1127.19.1.el7.x86_64/include/uapi/linux/stddef.h /usr/src/kernels/3.10.0-693.el7.x86_64/include/linux/stddef.h /usr/src/kernels/3.10.0-693.el7.x86_64/include/uapi/linux/stddef.h将
/usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/stddef.h添加到pcscfg.cfg文件中:
sys_include=($ORACLE_HOME/precomp/public,/usr/include,/usr/lib/gcc/x86_64-redh at-linux/4.1.2/include,/usr/lib/gcc/x86_64-redhat-linux/4.4.7/include,/usr/lib /gcc/x86_64-redhat-linux/4.4.4/include,/usr/lib64/gcc/x86_64-suse-linux/4.8/in clude,/usr/lib/gcc/x86_64-redhat-linux/4.8.2/include)再次编译就可以了
从*.pc源码到可执行程序需要经过两次编译,第一次:proc编译器将*.pc编译成*.c,第二次:gcc编译器将*.c编译成可执行程序。
在第一次编译*.pc时,proc编译器需要识别哪些代码段是否需要编译,像main int char long 等c语言的关键字要能够识别吧,但是proc编译器识别的依据是什么呢,就是proc编译器配置文件(pcscfg.cfg)默认的配置:/...gcc/x86_64-redhat-linux/4.4.7/include 或者 /...gcc/x86_64-redhat-linux/4.4.4/include 或者 /.../gcc/x86_64-suse-linux/4.8/include ,所以编译时都找不到 或者版本不兼容,因为gcc编译器安装的头文件版本是:/usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/