c - OCIObjectGetAttr 和 OCIObjectSetAttr 的 LNK2091 错误

标签 c windows linker-errors static-linking oracle-call-interface

我有一个静态链接到 oci.lib (12.1.0.1.0) 的小型 Windows x64 控制台程序,该程序到目前为止运行良好,直到我尝试使用 API OCIObjectGetAttr/OCIObjectSetAttr。现在我的程序出现以下链接器错误:

  • 错误 19 错误 LNK2019:无法解析的外部符号“int __cdecl OCIObjectSetAttr(struct OCIEnv *,struct OCIError *,void *,void *,struct OCIType *,unsigned char const * *,unsigned int const *,unsigned int ,unsigned int const *,unsigned int,short,void const *,void const *)"(?OCIObjectSetAttr@@YAHPEAUOCIEnv@@PEAUOCIError@@PEAX2PEAUOCIType@@PEAPEBEPEBII5IFPEBX6@Z) 在函数“bool __cdecl dump_object(struct OCIEnv *,结构 OCIError *,结构 OCISvcCtx *,void *,void *,void *)"(?dump_object@@YA_NPEAUOCIEnv@@PEAUOCIError@@PEAUOCISvcCtx@@PEAX33@Z)

  • 错误 20 错误 LNK2019:无法解析的外部符号“int __cdecl OCIObjectGetAttr(struct OCIEnv *,struct OCIError *,void *,void *,struct OCIType *,unsigned char const * *,unsigned int const *,unsigned int ,unsigned int const *,unsigned int,short *,void * *,void * *,struct OCIType * *)"(?OCIObjectGetAttr@@YAHPEAUOCIEnv@@PEAUOCIError@@PEAX2PEAUOCIType@@PEAPEBEPEBII5IPEAFPEAPEAX7PEAPEAU3@@Z) 在函数“bool”中引用__cdecl dump_object(struct OCIEnv *,struct OCIError *,struct OCISvcCtx *,void *,void *,void *)"(?dump_object@@YA_NPEAUOCIEnv@@PEAUOCIError@@PEAUOCISvcCtx@@PEAX33@Z)

仅注释这两个 API 可修复链接器错误。我确保除了添加两个 OCIObjectGetAttr 和 OCIObjectSetAttr API 调用之外,项目中没有任何更改。其他 OCIObject* API 正在链接。 dumpbin/exports oci.lib 显示 OCIObjectGetAttr 和 OCIObjectSetAttr 是从 oci.lib 导出的。

我错过了什么?

纠结这个问题有一段时间了。 Google/社区搜索也没有帮助。

请帮忙。

TIA

注意:Also posted in OTN (https://community.oracle.com/message/12457198#12457198) 绝望中请原谅重复发帖

最佳答案

似乎是 orid.h 中的一个错误,以下让我继续。我试图从 C++ 链接,因为 orid.h 缺少标准 extern“C” block ,用于像其他 oci 头文件一样从 C++ 链接。

将 orid.h 的内容包含在以下内容中使我成功编译。

#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif /* __cplusplus */

希望 Oracle 在下一个即时客户端版本中修复它:)。

感谢Ceannddevienne帮助我缩小范围。

关于c - OCIObjectGetAttr 和 OCIObjectSetAttr 的 LNK2091 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23919398/

相关文章:

c - 键盘输入使功能无法正常工作 - C

c - AT&T 汇编 + C 函数。使用 Scanf 进行字符串输入

windows - 如何用另一个 .exe 包装对 .exe(带参数)的调用?

linux - "relocation R_X86_64_32S against `.bss ' can not be used when making a shared object”

ios - Google Consent SDK - 链接器错误

c++ - 为什么虚拟函数在分配给 'new' 时不能未实现?

c - 使用循环在数组中生成唯一随机数

C fprintf 编码字符串跳过

c++ - 如何获取接口(interface) getaddrinfo() (addrinfo) 用于 connect() 的 IP

windows - Powershell 警告和错误处理