我有第三方库。 (msvc10)MT / MD(静态cfgs)和动态DLL cfg 我有qt + msvc10 express + win sdk.7
好的,我使用提供的现有示例,(使用libs)我无法编译.....我有4个未解决的同一个lib的外部错误。 (但我对其他人没有错误) 我没有支持这些lib ......(但它们是合法的,我是没有权利的成员)
调查可能修复的步骤是什么?在哪里我要看? 感谢。
编辑1:
错误是:
TD_ExamplesCommon.lib(ExHostAppServices.obj) : error LNK2019: unresolved external symbol __imp__RegEnumValueW@32 referenced in function "public: virtual bool __thiscall ExHostAppServices::ttfFileNameByDescriptor(class OdTtfDescriptor const &,class OdString &)" (?ttfFileNameByDescriptor@ExHostAppServices@@UAE_N ABVOdTtfDescriptor@@AAVOdString@@@Z)
TD_ExamplesCommon.lib(ExHostAppServices.obj) : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function "public: virtual bool __thiscall ExHostAppServices::ttfFileNameByDescriptor(class OdTtfDescriptor const &,class OdString &)" (?ttfFileNameByDescriptor@ExHostAppServices@@UAE_N ABVOdTtfDescriptor@@AAVOdString@@@Z)
TD_ExamplesCommon.lib(ExHostAppServices.obj) : error LNK2019: unresolved external symbol __imp__RegQueryValueExW@24 referenced in function "public: virtual bool __thiscall ExHostAppServices::ttfFileNameByDescriptor(class OdTtfDescriptor const &,class OdString &)" (?ttfFileNameByDescriptor@ExHostAppServices@@UAE_N ABVOdTtfDescriptor@@AAVOdString@@@Z)
TD_ExamplesCommon.lib(ExHostAppServices.obj) : error LNK2019: unresolved external symbol __imp__RegOpenKeyExW@20 referenced in function "public: virtual bool __thiscall ExHostAppServices::ttfFileNameByDescriptor(class OdTtfDescriptor const &,class OdString &)" (?ttfFileNameByDescriptor@ExHostAppServices@@UAE_N ABVOdTtfDescriptor@@AAVOdString@@@Z)
..\exe\OdaQtApp.exe : fatal error LNK1120: 13 unresolved externals
在这篇文章中,我收到了一个解决方案:我必须与Advapi32.lib链接... 我的问题是:我怎么知道这个? 我尝试过dependencyywalker,但它不能使用.lib的....
答案 0 :(得分:11)
在这篇文章中,我收到了一个解决方案:我必须与Advapi32.lib联系......我的问题是:我怎么知道这个?
当您从链接器收到“未解决的外部”错误时,这意味着它正在查找某个对象文件需要的函数或变量名称的匹配项,并且链接器无法找到其中一个定义的名称目标文件或库。
首先看一下这些错误中的第一个(我重新格式化了一下以使其更具可读性 - 我鼓励你在下次碰到其中一个时也这样做):
TD_ExamplesCommon.lib(ExHostAppServices.obj) : error LNK2019: unresolved external symbol
__imp__RegEnumValueW@32 referenced in function
"public: virtual bool __thiscall ExHostAppServices::ttfFileNameByDescriptor(
class OdTtfDescriptor const &,class OdString &)"
(?ttfFileNameByDescriptor@ExHostAppServices@@UAE_N ABVOdTtfDescriptor@@AAVOdString@@@Z)
该错误消息中有很多内容(大部分可能看起来像垃圾)。幸运的是,在大多数情况下,大部分都可以忽略。最重要的项目是链接器正在寻找符号__imp__RegEnumValueW@32
这个名字上面有一些垃圾,但幸运的是它无论如何都很容易识别。
__imp__
前缀表示它正在寻找DLL导入。在几乎所有可以为您的目的忽略的情况下。@32
后缀是Microsoft编译器为某些调用约定添加到函数名称的内容。它通常对你的目的并不重要(对于记录它表明该函数需要32字节的参数数据)所以我们留下链接器正在寻找RegEnumValueW
的事实。这看起来很像Win32 API的名称。
如果您查看RegEnumValueW
(或RegEnumValue
的文档,因为许多Win32 API都有A
和W
变体来处理ANSI / UNICODE版本)我们会在文档中找到这些信息:
Requirements
Minimum supported client Windows 2000 Professional
Minimum supported server Windows 2000 Server
Header Winreg.h (include Windows.h)
>> Library Advapi32.lib
DLL Advapi32.dll
Unicode and ANSI names RegEnumValueW (Unicode) and
RegEnumValueA (ANSI)
这就是你知道自己需要的advapi32.lib
。
所以在将来,当你从链接器中得到一个“未解决的外部”错误时,只需忽略错误消息中的大部分垃圾并集中注意它所说无法找到的符号 - 这应该会引导你进入库,目标文件或您可能缺少的其他项目。
只是为了记录,大多数Windows应用程序都需要advapi32.lib
。
答案 1 :(得分:0)
您可以尝试使用dependencywalker查看dll的依赖项列表,看看它缺少的内容。
答案 2 :(得分:0)
您是否在链接器选项中输入了* .lib文件? (输入 - >附加依赖项“),另外还有库目录选项中.lib的路径?