0
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

有什么解决办法吗?

pcscfg.cfg

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 中。

4

2 回答 2

1

报告的第一个错误 PCC-S-02014 实际上是重要的错误。Pro*C 预编译器会忽略一些 C 预处理器指令,但不会#warning- 它不理解它,并且认为warning#.

您可以使用ORA_PROC宏来避免在此阶段包含有问题的头文件。假设上一个答案中给出的位置是正确的,您可以#include像这样“隐藏”预处理器:

#ifndef ORA_PROC
#include <standards.h>
#endif

当然,您可能不会直接包含该文件,因此您可能需要计算出层次结构以查看您真正需要在源文件中排除哪个文件。在您的情况下,您似乎可以隐藏mydb.hmy_db.pc文件中,但这似乎太过分了;standard.h隐藏在您的文件中可能会更好mydb.h- 基本上排除您可以的最少代码量。我从错误消息中推测,您可能有更多层。

Pro*C/C++ 文档的高级主题部分对此进行了介绍。

这比复制和编辑系统头文件更容易,也比编辑原始文件安全得多。当然,它还允许您添加注释来解释正在发生的事情。

于 2012-07-29T17:50:32.800 回答
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文件复制到您的项目目录中,修复并使用它。

于 2012-07-27T06:50:28.117 回答