On Dec 24, 5:26 am, Stingrey <[email protected]> wrote: > I tryed to write a simple hash programm that just reads a file and > then calculates a tiger hash of it. > While compiling I get the following errors: > > 1>hash_tiger.obj : error LNK2001: Nicht aufgelöstes externes Symbol > ""public: virtual void __cdecl CryptoPP::IteratedHashBase<unsigned > __int64,class CryptoPP::HashTransformation>::Update(unsigned char > const *,unsigned __int64)" (?upd...@? > $iteratedhashb...@_kvhashtransformation@CryptoPP@@@CryptoPP@@ueaaxpeb...@z)". > 1>hash_tiger.obj : error LNK2001: Nicht aufgelöstes externes Symbol > ""public: virtual unsigned char * __cdecl > CryptoPP::IteratedHashBase<unsigned __int64,class > CryptoPP::HashTransformation>::CreateUpdateSpace(unsigned __int64 > &)" (?createupdatesp...@? > $iteratedhashb...@_kvhashtransformation@CryptoPP@@@CryptoPP@@ueaapeaeae...@z)". > 1>hash_tiger.obj : error LNK2001: Nicht aufgelöstes externes Symbol > ""public: virtual void __cdecl CryptoPP::IteratedHashBase<unsigned > __int64,class CryptoPP::HashTransformation>::Restart(void)" (?rest...@? > $iteratedhashb...@_kvhashtransformation@CryptoPP@@@CryptoPP@@UEAAXXZ)". > 1>hash_tiger.obj : error LNK2001: Nicht aufgelöstes externes Symbol > ""public: virtual void __cdecl CryptoPP::Tiger::TruncatedFinal > (unsigned char *,unsigned __int64)" (? > truncatedfi...@tiger@CryptoPP@@ueaaxpea...@z)". > 1>hash_tiger.obj : error LNK2001: Nicht aufgelöstes externes Symbol > ""public: virtual bool __cdecl > CryptoPP::HashTransformation::TruncatedVerify(unsigned char const > *,unsigned __int64)" (? > truncatedver...@hashtransformation@CryptoPP@@ueaa_npeb...@z)". > 1>hash_tiger.obj : error LNK2001: Nicht aufgelöstes externes Symbol > ""protected: virtual unsigned __int64 __cdecl > CryptoPP::IteratedHashBase<unsigned __int64,class > CryptoPP::HashTransformation>::HashMultipleBlocks(unsigned __int64 > const *,unsigned __int64)" (?hashmultipleblo...@? > $iteratedhashb...@_kvhashtransformation@CryptoPP@@@CryptoPP@@meaa_kpeb_...@z)". > 1>hash_tiger.obj : error LNK2019: Verweis auf nicht aufgelöstes > externes Symbol ""public: static void __cdecl > CryptoPP::Tiger::Transform(unsigned __int64 *,unsigned __int64 const > *)" (?transf...@tiger@CryptoPP@@saxpea_kpe...@z)" in Funktion > ""protected: virtual void __cdecl > CryptoPP::IteratedHashWithStaticTransform<unsigned __int64,struct > CryptoPP::EnumToType<enum CryptoPP::ByteOrder,0>,64,24,class > CryptoPP::Tiger,0>::HashEndianCorrectedBlock(unsigned __int64 const > *)" (?hashendiancorrectedbl...@?$iteratedhashwithstatictransform@_KU? > $enumtot...@w4byteorder@CryptoPP@@$0A@@CryptoPP@@$...@$0bi@vti...@2@ > $0A@@CryptoPP@@meaaxpe...@z)". > 1>hash_tiger.obj : error LNK2019: Verweis auf nicht aufgelöstes > externes Symbol ""public: static void __cdecl > CryptoPP::Tiger::InitState(unsigned __int64 *)" (? > initst...@tiger@CryptoPP@@saxpe...@z)" in Funktion ""protected: > virtual void __cdecl > CryptoPP::IteratedHashWithStaticTransform<unsigned __int64,struct > CryptoPP::EnumToType<enum CryptoPP::ByteOrder,0>,64,24,class > CryptoPP::Tiger,0>::Init(void)" (?i...@? > $iteratedhashwithstatictransf...@_ku?$enumtotype@w4byteor...@cryptopp@@ > $0A@@CryptoPP@@$...@$0bi@vti...@2@$0A@@CryptoPP@@MEAAXXZ)". > 1>hash_tiger.obj : error LNK2019: Verweis auf nicht aufgelöstes > externes Symbol ""public: __cdecl CryptoPP::Algorithm::Algorithm > (bool)" (??0algori...@cryptopp@@q...@_n@Z)" in Funktion ""public: > __cdecl CryptoPP::HashTransformation::HashTransformation(void)" (?? > 0hashtransformat...@cryptopp@@q...@xz)". > > Here is the code of my Programm if it helps: > > // hash_tiger.cpp : Definiert den Einstiegspunkt für die > Konsolenanwendung. > // > > #include <iostream> > #include <fstream> > > #include "stdafx.h" > #include "..\Crypto\tiger.h" > > using namespace std; > using namespace CryptoPP; > > ifstream::pos_type size; > byte * pbData; > > int _tmain(int argc, char *argv[]) > { > string filename = "C:\temp.dat"; > > ifstream dat_ein; > byte abDigest[Tiger::DIGESTSIZE]; > > /* > if(argc > 1) > filename = argv[1]; > else > { > cerr << "Wrong paramter!"; > return 1; > } > */ > > /* File input */ > dat_ein.open(filename.c_str(), ios::in | ios::binary | ios::ate); > // > open file for binary input with pointer at end of file > if(!dat_ein) > { > cerr << "Error with file!"; > return 1; > } > > size = dat_ein.tellg(); // get the size of the file > pbData = new byte [size]; // allocation of memory > > dat_ein.seekg (0, ios::beg); // set pointer to beginning of file > dat_ein.read((char *) &pbData, size); // read whole file at once > dat_ein.close(); // close file > > /* Crypto++ */ > Tiger thash; > thash.CalculateDigest(abDigest, pbData, size); > > cout << "Hash for file = " << abDigest; > return 0; > > } > > If somebody knows where the error lies, I would be very thankful.
The errors are for unresolved externals. That means that the crypto library symbols were not found. There are two possible explanations: 1. You did not add a dependency for the crypto++ library project and so the linker did not know where to find the symbols. 2. You compiled the crypto++ library with different options and so the signatures of the name mangled functions are not the same. If the problem is #1, then add a project dependency. If the problem is #2, then change the compilation so that the following are true: A. The character model is the same (e.g. Unicode verses Multibyte verses char under: Configuation Properties/General/Character Set) B. The linking model is the same: Configuation Properties/C++/Code Generation/Runtime Library C. The calling convention is the same: Configuation Properties/C++/ Advanced/Calling convention --~--~---------~--~----~------------~-------~--~----~ 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. -~----------~----~----~----~------~----~------~--~---
