Archived Forum Post

Index of archived forum posts

Question:

Chilkat VC++ libs compiled/linked on QT 5.4.1 on Windows

Mar 19 '15 at 13:00

I get these link errors:

Os Windows 8.1 64 bit
Qt 5.4.1 MSVC 2013 OpenGL 32 bit
chilkat 9.5.0-x86-vc12

---.pro INCLUDEPATH += C:/chilkat/include DEPENDPATH += C:/chilkat/include LIBS += -Lc:/chilkat/libs -lChilkatDbg

Code: #include <ckzip.h> CkZip zip

Error ChilkatDbgDll.lib(Psdk.obj):-1: error: LNK2019: unresolved external symbol impGetUserNameA@8 referenced in function "public: static void cdecl Psdk:: getUsername(class chilkat::StringBuffer &)" (? getUsername@Psdk@@SAXAAVStringBuffer@chilkat@@@Z) ChilkatDbgDll.lib(Psdk.obj):-1: error: LNK2019: unresolved external symbol impRegCreateKeyExA@36 referenced in function "public: static long cdecl PsdkWin32::regCreateKeyEx(struct HKEY ,char const ,unsigned int,char const ,unsigned int,unsigned long,struct _SECURITY_ATTRIBUTES ,struct HKEY * , unsigned long )" (? regCreateKeyEx@PsdkWin32@@SAJPAUHKEY@@PBDI1IKPAU_SECURITY_ATTRIBUTES@@PAPAU2@PAK@Z) ChilkatDbgDll.lib(Psdk.obj):-1: error: LNK2019: unresolved external symbol impRegOpenKeyExA@20 referenced in function "public: static long cdecl PsdkWin32::regOpenKeyEx(struct HKEY ,char const ,unsigned int,unsigned long, struct HKEY * )" (?regOpenKeyEx@PsdkWin32@@SAJPAUHKEY@@PBDIKPAPAU2@@Z) ChilkatDbgDll.lib(Psdk.obj):-1: error: LNK2019: unresolved external symbol impCryptAcquireContextA@20 referenced in function "public: static int cdecl PsdkWin32::cryptAcquireContext(unsigned long ,char const ,char const ,unsigned int,unsigned int)" (?cryptAcquireContext@PsdkWin32@@SAHPAKPBD1II@Z) ChilkatDbgDll.lib(Entropy.obj):-1: error: LNK2019: unresolved external symbol impCryptReleaseContext@8 referenced in function "public: static bool cdecl Entropy::getRandomBytes2(int,unsigned char *)" (? getRandomBytes2@Entropy@@SA_NHPAE@Z) ChilkatDbgDll.lib(Entropy.obj):-1: error: LNK2019: unresolved external symbol impCryptGenRandom@12 referenced in function "public: static bool cdecl Entropy::getRandomBytes2(int,unsigned char *)" (? getRandomBytes2@Entropy@@SA_NHPAE@Z) debugChilkatTest.exe:-1: error: LNK1120: 6 unresolved externals


Answer

The unresolved externals are VC++ runtime library functions. They require additional Microsoft VC++ libs to be linked. You can find out which MSVC library contains the given Platform SDK function by doing this:

  1. Google the function name to find the MSVC reference doc for the function. For example, Google "RegCreateKeyEx" or "CryptGenRandom".
  2. Find the "Requirements" section near the bottom of the documentation web page. For example, for RegCreateKeyEx, the library is Advapi32.lib
  3. To save you time, the other libraries will likely be: crypt32.lib, ws2_32.lib, and dnsapi.lib

Add these libs to be linked with your QT app...