由于名称修改而导致无法解析的外部符号 [英] unresolved external symbol due to name mangling

查看:88
本文介绍了由于名称修改而导致无法解析的外部符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将XERCES功能从2.6升级到2.8时,我遇到了链接器错误

I am facing linker error for a XERCES function while upgrading it from 2.6 to 2.8

unresolved external symbol (?resolveEntity@HandlerBase@xercesc_2_8@@UAEPAVInputSource@2@QBG0@Z)

我检查了xerces-c_2.8.lib,发现lib名称与.obj文件中的lib有点不同

I checked the xerces-c_2.8.lib and found that name lib is bit different that the one in my .obj file It is as shown

?resolveEntity@HandlerBase@xercesc_2_8@@UAEPAVInputSource@2@QB_W0@Z

所以我知道链接器不会找到匹配项并抛出错误.

So I understand that linker wont find the match and throw error.

但是我无法理解为什么我的.obj文件包含不同的签名.

But I am unable to understand why my .obj file contains different signature.

代码包含正确的头文件和名称仍然不正确的库.

code is including correct header files and lib from still incorrect name.

任何帮助将不胜感激.

推荐答案

您可以使用undname.exe实用工具恢复原始的C ++声明.

You can use the undname.exe utility to recover the original C++ declaration.

?resolveEntity @ HandlerBase @ xercesc_2_8 @@ UAEPAVInputSource @ 2 @ QBG0 @ Z转换为:

?resolveEntity@HandlerBase@xercesc_2_8@@UAEPAVInputSource@2@QBG0@Z converts to:

virtual class xercesc_2_8::InputSource * 
__thiscall xercesc_2_8::HandlerBase::resolveEntity(
    unsigned short const * const,
    unsigned short const * const)

?resolveEntity @ HandlerBase @ xercesc_2_8 @@ UAEPAVInputSource @ 2 @ QB_W0 @ Z转换为:

?resolveEntity@HandlerBase@xercesc_2_8@@UAEPAVInputSource@2@QB_W0@Z converts to:

virtual class xercesc_2_8::InputSource * 
__thiscall xercesc_2_8::HandlerBase::resolveEntity(
     wchar_t const * const,
     wchar_t const * const)

请注意参数类型unsigned shortwchar_t的区别.由于某种原因,您的编译器无法识别wchar_t类型.那可能是因为您有一个非常旧的编译器.或者它可能是一个错误的选项集,在msvc上是C/C ++,语言,将wchar_t处理为内置类型".或者,您有一个宏可以将字符串类型修改为无符号短整数.

Note the differences in the argument types, unsigned short vs wchar_t. For some reason, your compiler is not recognizing the wchar_t type. That could be because you have a very old compiler. Or it can be an option set wrong, on msvc it is C/C++, Language, "Treat wchar_t as Built-in type". Or you've got a macro that hacks the string type to unsigned short.

这篇关于由于名称修改而导致无法解析的外部符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆