现在的位置: 首页 > 综合 > 正文

解决multiple definition of sqlca的问题

2013年10月04日 ⁄ 综合 ⁄ 共 545字 ⁄ 字号 评论关闭

    在访问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.

抱歉!评论已关闭.