Reputation: 2257
I'm linking with a third-party library (Poco C++) and getting the following unresolved symbol errors from the linker. It appears to be unable to find "CryptAcquireContextW", "CryptReleaseContext", and "CryptGenRandom".
According to the Microsoft information here, these functions are linkable using "Advapi32.lib". I've added that to my linker inputs but the symbols remain unresolved.
1>PocoFoundationCLR.lib(RandomStream.obj) : error LNK2019: unresolved external symbol __imp__CryptAcquireContextW@20 referenced in function "public: virtual int __thiscall Poco::RandomBuf::readFromDevice(char *,__int64)" (?readFromDevice@RandomBuf@Poco@@UAEHPAD_J@Z)
1>PocoFoundationCLR.lib(RandomStream.obj) : error LNK2019: unresolved external symbol __imp__CryptReleaseContext@8 referenced in function "public: virtual int __thiscall Poco::RandomBuf::readFromDevice(char *,__int64)" (?readFromDevice@RandomBuf@Poco@@UAEHPAD_J@Z)
1>PocoFoundationCLR.lib(RandomStream.obj) : error LNK2019: unresolved external symbol __imp__CryptGenRandom@12 referenced in function "public: virtual int __thiscall Poco::RandomBuf::readFromDevice(char *,__int64)" (?readFromDevice@RandomBuf@Poco@@UAEHPAD_J@Z)
I've verified that Advapi32.lib is on the search path and Advapi32.dll is in the Windows directory, so I'm not sure how this error continues to happen.
Ideas, anyone?
Thanks!
Upvotes: 7
Views: 4930
Reputation: 2257
Although I can't readily explain why this worked, here's what did.
The project that was failing had "Advapi32.lib" listed in the "Inherited" section of the linker inputs, but apparently wasn't actually being linked in.
I added "Advapi32.lib" to the "additional libraries" section and somehow that caused it to be picked up and linked with properly.
I'm going to write it off as just a difference in how VS 2013 was installed on the two PCs, but it's still a curious oddity.
Upvotes: 5