I'm new to Crypto++ and am trying to work my way up the learning curve. I am just trying to create a SHA256 HMAC of a string with a key. After searching for a long time I found some example code here: http://comments.gmane.org/gmane.comp.encryption.cryptopp/5388 and got it to compile.
I used the instructions here: http://www.codeproject.com/KB/tips/CryptoPPIntegration.aspx and used them to compile the Crypto++ library and add the directories to my VS2003 options and project settings. Since my project is /MD(d) I switched the project settings for the cryptlib to that as well in the DLL-Import Release and Debug that I compiled. I moved the cryptlib.lib and cryptlibd.lib files to the folder where I have the source code. Here is what I am including in my source file: #include "sha.h" #include "hmac.h" #include "base64.h" #include <sstream> #ifdef _DEBUG # pragma comment ( lib, "cryptlibd" ) #else # pragma comment ( lib, "cryptlib" ) #endif When I try to run my MFC based application it won't link. I get the errors below and more that are in the obj file for my source code, which I have removed. cryptlibd.lib(base64.obj) : warning LNK4217: locally defined symbol ?? 1AlgorithmParameters@CryptoPP@@UAE@XZ (public: virtual __thiscall CryptoPP::AlgorithmParameters::~AlgorithmParameters(void)) imported in function "public: virtual void __thiscall CryptoPP::Base64Encoder::IsolatedInitialize(class CryptoPP::NameValuePairs const &)" (? IsolatedInitialize@Base64Encoder@CryptoPP@@UAEXABVNameValuePairs@2@@Z) cryptlibd.lib(base64.obj) : warning LNK4217: locally defined symbol ? allocate@?$AllocatorWithCleanup@E$0A@@CryptoPP@@QAEPAEIPBX@Z (public: unsigned char * __thiscall CryptoPP::AllocatorWithCleanup<unsigned char,0>::allocate(unsigned int,void const *)) imported in function "public: __thiscall CryptoPP::SecBlock<unsigned char,class CryptoPP::AllocatorWithCleanup<unsigned char,0> >::SecBlock<unsigned char,class CryptoPP::AllocatorWithCleanup<unsigned char,0> >(unsigned int)" (??0?$SecBlock@EV?$AllocatorWithCleanup@E $0A@@CryptoPP@@@CryptoPP@@QAE@I@Z) cryptlibd.lib(base64.obj) : warning LNK4217: locally defined symbol ? deallocate@?$AllocatorWithCleanup@E$0A@@CryptoPP@@QAEXPAXI@Z (public: void __thiscall CryptoPP::AllocatorWithCleanup<unsigned char, 0>::deallocate(void *,unsigned int)) imported in function "public: __thiscall CryptoPP::SecBlock<unsigned char,class CryptoPP::AllocatorWithCleanup<unsigned char,0> >::~SecBlock<unsigned char,class CryptoPP::AllocatorWithCleanup<unsigned char,0> >(void)" (?? 1?$SecBlock@EV?$AllocatorWithCleanup@E $0A@@CryptoPP@@@CryptoPP@@QAE@XZ) cryptlibd.lib(base64.obj) : warning LNK4217: locally defined symbol ?? 0?$AlgorithmParametersTemplate@H@CryptoPP@@QAE@PBDABH_N@Z (public: __thiscall CryptoPP::AlgorithmParametersTemplate<int>::AlgorithmParametersTemplate<int>(char const *,int const &,bool)) imported in function "public: class CryptoPP::AlgorithmParameters & __thiscall CryptoPP::AlgorithmParameters::operator()<int>(char const *,int const &,bool)" (??$?RH@AlgorithmParameters@CryptoPP@@QAEAAV01@PBDABH_N@Z) cryptlibd.lib(base64.obj) : warning LNK4217: locally defined symbol ?? 1?$AlgorithmParametersTemplate@H@CryptoPP@@UAE@XZ (public: virtual __thiscall CryptoPP::AlgorithmParametersTemplate<int>::~AlgorithmParametersTemplate<int>(void)) imported in function "public: virtual void * __thiscall CryptoPP::AlgorithmParametersTemplate<int>::`scalar deleting destructor'(unsigned int)" (??_G? $AlgorithmParametersTemplate@H@CryptoPP@@UAEPAXI@Z) cryptlibd.lib(base64.obj) : warning LNK4217: locally defined symbol ?? 0AlgorithmParametersBase@CryptoPP@@QAE@PBD_N@Z (public: __thiscall CryptoPP::AlgorithmParametersBase::AlgorithmParametersBase(char const *,bool)) imported in function "public: __thiscall CryptoPP::AlgorithmParametersTemplate<unsigned char const *>::AlgorithmParametersTemplate<unsigned char const *>(char const *,unsigned char const * const &,bool)" (??0? $AlgorithmParametersTemplate@PBE@CryptoPP@@QAE@PBDABQBE_N@Z) cryptlibd.lib(base64.obj) : warning LNK4217: locally defined symbol ? ThrowIfTypeMismatch@NameValuePairs@CryptoPP@@SAXPBDABVtype_info@@1@Z (public: static void __cdecl CryptoPP::NameValuePairs::ThrowIfTypeMismatch(char const *,class type_info const &,class type_info const &)) imported in function "public: virtual void __thiscall CryptoPP::AlgorithmParametersTemplate<unsigned char const *>::AssignValue(char const *,class type_info const &,void *)const " (? AssignValue@? $AlgorithmParametersTemplate@PBE@CryptoPP@@UBEXPBDABVtype_info@@PAX@Z) cryptlibd.lib(base64.obj) : warning LNK4217: locally defined symbol ?? 0AlgorithmParametersBase@CryptoPP@@QAE@ABV01@@Z (public: __thiscall CryptoPP::AlgorithmParametersBase::AlgorithmParametersBase(class CryptoPP::AlgorithmParametersBase const &)) imported in function "public: __thiscall CryptoPP::AlgorithmParametersTemplate<unsigned char const *>::AlgorithmParametersTemplate<unsigned char const *>(class CryptoPP::AlgorithmParametersTemplate<unsigned char const *> const &)" (??0? $AlgorithmParametersTemplate@PBE@CryptoPP@@QAE@ABV01@@Z) cryptlibd.lib(base64.obj) : warning LNK4217: locally defined symbol ?? 0InvalidArgument@CryptoPP@@QAE@ABV?$basic_string@DU? $char_traits@D@std@@V?$allocator@D@2@@std@@@Z (public: __thiscall CryptoPP::InvalidArgument::InvalidArgument(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)) imported in function "void __stdcall CryptoPP::memcpy_s(void *,unsigned int,void const *,unsigned int)" (? memcpy_s@CryptoPP@@YGXPAXIPBXI@Z) cryptlibd.lib(base64.obj) : warning LNK4217: locally defined symbol ?? 1AlgorithmParametersBase@CryptoPP@@UAE@XZ (public: virtual __thiscall CryptoPP::AlgorithmParametersBase::~AlgorithmParametersBase(void)) imported in function "public: virtual __thiscall CryptoPP::AlgorithmParametersTemplate<unsigned char const *>::~AlgorithmParametersTemplate<unsigned char const *>(void)" (??1? $AlgorithmParametersTemplate@PBE@CryptoPP@@UAE@XZ) cryptlibd.lib(base64.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CryptoPP::CombinedNameValuePairs::~CombinedNameValuePairs(void)" (__imp_?? 1CombinedNameValuePairs@CryptoPP@@UAE@XZ) referenced in function "public: virtual void __thiscall CryptoPP::Base64Encoder::IsolatedInitialize(class CryptoPP::NameValuePairs const &)" (? IsolatedInitialize@Base64Encoder@CryptoPP@@UAEXABVNameValuePairs@2@@Z) cryptlibd.lib(base64.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall CryptoPP::CombinedNameValuePairs::CombinedNameValuePairs(class CryptoPP::NameValuePairs const &,class CryptoPP::NameValuePairs const &)" (__imp_?? 0CombinedNameValuePairs@CryptoPP@@QAE@ABVNameValuePairs@1@0@Z) referenced in function "public: virtual void __thiscall CryptoPP::Base64Encoder::IsolatedInitialize(class CryptoPP::NameValuePairs const &)" (? IsolatedInitialize@Base64Encoder@CryptoPP@@UAEXABVNameValuePairs@2@@Z) cryptlibd.lib(base64.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall CryptoPP::NameValuePairs::GetIntValueWithDefault(char const *,int)const " (__imp_? GetIntValueWithDefault@NameValuePairs@CryptoPP@@QBEHPBDH@Z) referenced in function "public: virtual void __thiscall CryptoPP::Base64Encoder::IsolatedInitialize(class CryptoPP::NameValuePairs const &)" (? IsolatedInitialize@Base64Encoder@CryptoPP@@UAEXABVNameValuePairs@2@@Z) cryptlibd.lib(base64.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static void __cdecl CryptoPP::BaseN_Decoder::InitializeDecodingLookupArray(int *,unsigned char const *,unsigned int,bool)" (__imp_? InitializeDecodingLookupArray@BaseN_Decoder@CryptoPP@@SAXPAHPBEI_N@Z) referenced in function "private: static int const * __cdecl CryptoPP::Base64Decoder::GetDecodingLookupArray(void)" (? GetDecodingLookupArray@Base64Decoder@CryptoPP@@CAPBHXZ) cryptlibd.lib(base64.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: unsigned char * __thiscall CryptoPP::AllocatorWithCleanup<unsigned char,0>::reallocate(unsigned char *,unsigned int,unsigned int,bool)" (__imp_?reallocate@? $AllocatorWithCleanup@E$0A@@CryptoPP@@QAEPAEPAEII_N@Z) referenced in function "public: void __thiscall CryptoPP::SecBlock<unsigned char,class CryptoPP::AllocatorWithCleanup<unsigned char,0> >::New(unsigned int)" (?New@?$SecBlock@EV?$AllocatorWithCleanup@E $0A@@CryptoPP@@@CryptoPP@@QAEXI@Z) cryptlibd.lib(base64.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall CryptoPP::AlgorithmParameters::AlgorithmParameters(class CryptoPP::AlgorithmParameters const &)" (__imp_?? 0AlgorithmParameters@CryptoPP@@QAE@ABV01@@Z) referenced in function "class CryptoPP::AlgorithmParameters __stdcall CryptoPP::MakeParameters<unsigned char const *>(char const *,unsigned char const * const &,bool)" (??$MakeParameters@PBE@CryptoPP@@YG? AVAlgorithmParameters@0@PBDABQBE_N@Z) cryptlibd.lib(base64.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall CryptoPP::AlgorithmParameters::AlgorithmParameters(void)" (__imp_?? 0AlgorithmParameters@CryptoPP@@QAE@XZ) referenced in function "class CryptoPP::AlgorithmParameters __stdcall CryptoPP::MakeParameters<unsigned char const *>(char const *,unsigned char const * const &,bool)" (??$MakeParameters@PBE@CryptoPP@@YG? AVAlgorithmParameters@0@PBDABQBE_N@Z) cryptlibd.lib(base64.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::AlgorithmParametersTemplate<class CryptoPP::ConstByteArrayParameter>::MoveInto(void *)const " (? MoveInto@? $AlgorithmParametersTemplate@VConstByteArrayParameter@CryptoPP@@@CryptoPP@@UBEXPAX@Z) cryptlibd.lib(base64.obj) : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::AlgorithmParametersTemplate<class CryptoPP::ConstByteArrayParameter>::AssignValue(char const *,class type_info const &,void *)const " (?AssignValue@? $AlgorithmParametersTemplate@VConstByteArrayParameter@CryptoPP@@@CryptoPP@@UBEXPBDABVtype_info@@PAX@Z) cryptlibd.lib(base64.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall CryptoPP::AlgorithmParametersTemplate<class CryptoPP::ConstByteArrayParameter>::AlgorithmParametersTemplate<class CryptoPP::ConstByteArrayParameter>(char const *,class CryptoPP::ConstByteArrayParameter const &,bool)" (__imp_??0? $AlgorithmParametersTemplate@VConstByteArrayParameter@CryptoPP@@@CryptoPP@@QAE@PBDABVConstByteArrayParameter@1@_N@Z) referenced in function "public: class CryptoPP::AlgorithmParameters & __thiscall CryptoPP::AlgorithmParameters::operator()<class CryptoPP::ConstByteArrayParameter>(char const *,class CryptoPP::ConstByteArrayParameter const &,bool)" (??$? RVConstByteArrayParameter@CryptoPP@@@AlgorithmParameters@CryptoPP@@QAEAAV01@PBDABVConstByteArrayParameter@1@_N@Z) cryptlibd.lib(base64.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __thiscall CryptoPP::AlgorithmParametersTemplate<class CryptoPP::ConstByteArrayParameter>::~AlgorithmParametersTemplate<class CryptoPP::ConstByteArrayParameter>(void)" (__imp_??1? $AlgorithmParametersTemplate@VConstByteArrayParameter@CryptoPP@@@CryptoPP@@UAE@XZ) referenced in function "public: virtual void * __thiscall CryptoPP::AlgorithmParametersTemplate<class CryptoPP::ConstByteArrayParameter>::`scalar deleting destructor'(unsigned int)" (??_G? $AlgorithmParametersTemplate@VConstByteArrayParameter@CryptoPP@@@CryptoPP@@UAEPAXI@Z) cryptlibd.lib(base64.obj) : error LNK2001: unresolved external symbol "__declspec(dllimport) bool (__cdecl* CryptoPP::g_pAssignIntToInteger) (class type_info const &,void *,void const *)" (__imp_? g_pAssignIntToInteger@CryptoPP@@3P6A_NABVtype_info@@PAXPBX@ZA) Can anyone help me get this to work? Thanks! David -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to [email protected]. More information about Crypto++ and this group is available at http://www.cryptopp.com.
