1

当我尝试在我的项目中使用 DCMTK (/MT) 库时,出现以下链接错误。我确定错误与VS2010的ws2_32.lib wsock32.lib netapi32.lib有关。但是我已经将这三个库添加到项目属性中。您可以看到已搜索库,如下所示。这些库位于 C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib 中。订单问题?有什么建议吗?

1>oflog.lib(ntelogap.obj) : error LNK2019: unresolved external symbol __imp__CopySid@12 referenced in function "bool __cdecl `anonymous namespace'::CopySid(struct _SID * *,struct _SID *)" (?CopySid@?A0x4f6604f8@@YA_NPAPAU_SID@@PAU2@@Z)

1>oflog.lib(ntelogap.obj) : error LNK2019: unresolved external symbol __imp__GetLengthSid@4 referenced in function "bool __cdecl `anonymous namespace'::CopySid(struct _SID * *,struct _SID *)" (?CopySid@?A0x4f6604f8@@YA_NPAPAU_SID@@PAU2@@Z)

1>oflog.lib(ntelogap.obj) : error LNK2019: unresolved external symbol __imp__GetTokenInformation@20 referenced in function "bool __cdecl `anonymous namespace'::GetCurrentUserSID(struct _SID * *)" (?GetCurrentUserSID@?A0x4f6604f8@@YA_NPAPAU_SID@@@Z)

1>oflog.lib(ntelogap.obj) : error LNK2019: unresolved external symbol __imp__OpenProcessToken@12 referenced in function "bool __cdecl `anonymous namespace'::GetCurrentUserSID(struct _SID * *)" (?GetCurrentUserSID@?A0x4f6604f8@@YA_NPAPAU_SID@@@Z)

1>oflog.lib(ntelogap.obj) : error LNK2019: unresolved external symbol __imp__RegCreateKeyExA@36 referenced in function "struct HKEY __ * __cdecl `anonymous namespace'::regGetKey(class OFString const &,unsigned long *)" (?regGetKey@?A0x4f6604f8@@YAPAUHKEY __@@ABVOFString@@PAK@Z)

1>oflog.lib(ntelogap.obj) : error LNK2019: unresolved external symbol __imp__RegSetValueExA@24 referenced in function "void __cdecl `anonymous namespace'::regSetString(struct HKEY __ *,class OFString const &,class OFString const &)" (?regSetString@?A0x4f6604f8@@YAXPAUHKEY __@@ABVOFString@@1@Z)

1>oflog.lib(ntelogap.obj) : error LNK2019: unresolved external symbol __imp__RegisterEventSourceA@8 referenced in function "protected: void __thiscall log4cplus::NTEventLogAppender::init(void)" (?init@NTEventLogAppender@log4cplus@@IAEXXZ)

1>oflog.lib(ntelogap.obj) : error LNK2019: unresolved external symbol __imp__DeregisterEventSource@4 referenced in function "public: virtual void __thiscall log4cplus::NTEventLogAppender::close(void)" (?close@NTEventLogAppender@log4cplus@@UAEXXZ)

1>oflog.lib(ntelogap.obj) : error LNK2019: unresolved external symbol __imp__ReportEventA@36 referenced in function "protected: virtual void __thiscall log4cplus::NTEventLogAppender::append(class log4cplus::spi::InternalLoggingEvent const &)" (?append@NTEventLogAppender@log4cplus@@MAEXABVInternalLoggingEvent@spi@2@@Z)

1>oflog.lib(ntelogap.obj) : error LNK2019: unresolved external symbol __imp__RegCloseKey@4 referenced in function "protected: void __thiscall log4cplus::NTEventLogAppender::addRegistryInfo(void)" (?addRegistryInfo@NTEventLogAppender@log4cplus@@IAEXXZ)

这是 lib 搜索的详细部分:

1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\ws2_32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\netapi32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\wsock32.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\libcpmtd.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\LIBCMT.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\OLDNAMES.lib:

....

1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\msvcprtd.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\MSVCRTD.lib:
1>      Searching C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\LIBCMTD.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\kernel32.lib:
1>      Searching C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\user32.lib:
....
4

1 回答 1

2

看起来您没有在Advapi32.lib中链接。将其添加到项目属性中的链接器 -> 输入 -> 附加依赖项。不要忘记为所有项目配置添加它(分别从配置和平台下拉菜单中选择“所有配置”和“所有平台”)。

于 2013-01-04T02:07:48.427 回答