Oracle version - 10.2.0.1.0
Pro*C/C++: Release 10.2.0.1.0
AIX version - 5.3
我无法使用以下错误进行编译。
Syntax error at line 135, column 2, file /usr/include/standards.h:
Error at line 135, column 2 in file /usr/include/standards.h
#warning The -qdfp option is required to process DFP code in headers.
.1
PCC-S-02014, Encountered the symbol "warning" when expecting one of the following:
a numeric constant, newline, define, elif, else, endif,
error, if, ifdef, ifndef, include, line, pragma, undef,
an immediate preprocessor command, a C token,
The symbol "newline," was substituted for "warning" to continue.
Syntax error at line 382, column 3, file mydb.h:
Error at line 382, column 3 in file mydb.h
time_t timestamp;
..1
PCC-S-02201, Encountered the symbol "time_t" when expecting one of the following
:
} char, const, double, enum, float, int, long, ulong_varchar,
OCIBFileLocator OCIBlobLocator, OCIClobLocator, OCIDateTime,
OCIExtProcContext, OCIInterval, OCIRowid, OCIDate, OCINumber,
OCIRaw, OCIString, short, signed, sql_context, sql_cursor,
struct, union, unsigned, utext, uvarchar, varchar, void,
volatile, a typedef name,
The symbol "enum," was substituted for "time_t" to continue.
Error at line 0, column 0 in file my_db.pc
PCC-F-02102, Fatal error while doing C preprocessing
make: *** [libdb.a] Error 1
任何解决方案?
sys_include=(/usr/include)
CODE=ANSI_C
parse=partial
sqlcheck=full
sys_include=/usr/include
sys_include=/usr/include/sys
sys_include=/usr/include/linux
include=$(ORACLE_HOME)/precomp/public
include=$(ORACLE_HOME)/precomp/include
include=$(ORACLE_HOME)/oracore/include
include=$(ORACLE_HOME)/oracore/public
include=$(ORACLE_HOME)/rdbms/include
include=$(ORACLE_HOME)/rdbms/public
include=$(ORACLE_HOME)/rdbms/demo
ltype=short
define=__64BIT__
define=_IBM_C
define=_LONG_LONG
AIX 5.2中完全相同的代码也没问题。问题出现在AIX 5.3中。
答案 0 :(得分:1)
报告的第一个错误PCC-S-02014实际上是重要的错误。 Pro * C预编译器会忽略一些C预处理器指令,但不会忽略#warning
- 它不理解它,并且认为warning
在#
之后是有效的。
您可以使用ORA_PROC
宏来避免在此阶段包含有问题的头文件。假设前一个答案中给出的位置是正确的,您可以像这样从预处理器中“隐藏”#include
:
#ifndef ORA_PROC
#include <standards.h>
#endif
当然您可能没有直接包含该文件,因此您可能需要设计heirarchy以查看您确实需要在源文件中排除哪个文件。在您的情况下,您似乎可以在mydb.h
文件中隐藏my_db.pc
,但这似乎过多;在standard.h
文件中隐藏mydb.h
可能更好 - 基本上排除了您可以使用的最少代码量。我猜错了消息,你可能有更多的层。
Pro * C / C ++文档的advanced topics部分对此进行了介绍。
这比复制和编辑系统头文件更容易,并且比编辑原始文件更安全。它还允许您添加解释当前正在发生的事情的评论。
答案 1 :(得分:0)
此问题通常发生在AIX 5.3及更高版本中。 /usr/include/standards.h与旧版本不同,我认为PCC无法编译。
要解决该问题,您必须更改standards.h中的以下内容。
FROM
---
#if defined(__IBM_PP_WARNING)
#warning The -qdfp option is required to process DFP code in headers.
#else
#error The -qdfp option is required to process DFP code in headers.
TO
--
//#if defined(__IBM_PP_WARNING)
//#warning The -qdfp option is required to process DFP code in headers.
//#else
#if !defined(__IBM_PP_WARNING)
#error The -qdfp option is required to process DFP code in headers.
我建议不要更改系统包含文件。因此,将standards.h
文件复制到项目目录中,修复并使用它。