eatcpp
eatcpp

Reputation: 73

Visual Studio 2010 library linking errors

I got the following linking errors when I tried to use DCMTK (/MT) library in my project. I am sure that the errors are related to ws2_32.lib wsock32.lib netapi32.lib of VS2010. But I have already added these three libs to the project property. You can see the libs had been searched as shown below. The libs are in C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib. order problem? Any suggestion?

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)

Here is the part of the verbose of lib searching:

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:
....

Upvotes: 2

Views: 5512

Answers (1)

user530189
user530189

Reputation:

Looks like you aren't linking in Advapi32.lib. Add that to Linker -> Input -> Additional Dependencies in your project properties. Don't forget to add it for all of your project configurations (select "All Configurations" and "All Platforms" from the Configuration and Platform dropdowns, respectively).

Upvotes: 4

Related Questions