在访问Oracle数据的程序中,有两个.pc文件,而每个文件都有语句:
#include "sqlca.h"
这样就引起“multiple definition of sqlca”的错误,解决办法为,
在一个.pc文件中加入定义:
#define SQLCA_STORAGE_CLASS extern
并且放在#include "sqlca.h"之前,即:
#define SQLCA_STORAGE_CLASS extern
#include “sqlca.h”
这样处理的原因参见Oracle的sqlca.h文件中的以下内容:
If the symbol SQLCA_STORAGE_CLASS is defined, then the SQLCA
will be defined to have this storage class. For example:
#define SQLCA_STORAGE_CLASS extern
will define the SQLCA as an extern.
本文介绍了解决Oracle程序中因多个.pc文件包含sqlca.h而导致的sqlca多重定义错误的方法。通过在其中一个.pc文件中定义SQLCA_STORAGE_CLASS为extern并置于#include指令前,可以避免该错误。
5771

被折叠的 条评论
为什么被折叠?



