Archived Forum Post

Index of archived forum posts

Question:

Unresolved externals VC++ VS2013

Feb 23 '16 at 21:57

This is the 4th time I ask this question and it still doesn't show up in the list anywhere!

I'm developing an MFC application linking with the library, ChilkatDbgDll.lib, in debug mode. The linker finds the library but it can't find any of the functions. My runtime library is set to Multi-threaded Debug DLL (/MDd). And here is an example of the errors:

1>EncryptView.obj : error LNK2019: unresolved external symbol "void * cdecl CkCrypt2_Create(void)" (?CkCrypt2_Create@@YAPAXXZ) referenced in function "public: void thiscall CEncryptView::OnEditMine(void)" (?OnEditMine@CEncryptView@@QAEXXZ) 1>EncryptView.obj : error LNK2019: unresolved external symbol "void cdecl CkCrypt2_putCryptAlgorithm(void ,char const )" (?CkCrypt2_putCryptAlgorithm@@YAXPAXPBD@Z) referenced in function "public: void thiscall CEncryptView::OnEditMine(void)" (?OnEditMine@CEncryptView@@QAEXXZ) 1>EncryptView.obj : error LNK2019: unresolved external symbol "void cdecl CkCrypt2_putEncodingMode(void ,char const )" (?CkCrypt2_putEncodingMode@@YAXPAXPBD@Z) referenced in function "public: void thiscall CEncryptView::OnEditMine(void)" (?OnEditMine@CEncryptView@@QAEXXZ) 1>EncryptView.obj : error LNK2019: unresolved external symbol "void cdecl CkCrypt2_putHashAlgorithm(void ,char const )" (?CkCrypt2_putHashAlgorithm@@YAXPAXPBD@Z) referenced in function "public: void thiscall CEncryptView::OnEditMine(void)" (?OnEditMine@CEncryptView@@QAEXXZ)

Any answers, please?


Answer

I'm sorry for the trouble. It seems you're using the "C" functions in an MFC C++ program? I'm not sure why you wouldn't use the C++ classes instead. In any case, the "C" functions are designed for "C" programs. If you are including from a .cpp, you must wrap the #include in an extern "C"

extern "C" {
#include "...."
}
This is how one would use any "C" API in C++...


Answer

Thanks for your answer. I just copied an example you provided on one of your pages for emulating the PBEWithMD5AndDES in Java. I will check out the C++ classes. Thanks again for your quick reply.