Hello and Thank you Mr. Wei Dai! I do as your advice and changed these two functions to lower case. And those 6 errors have been removed!
But now I get 74 link errors, parts of them are as following: ------ Build started: Project: cryptopp(hashmodule), Configuration: Debug Win32 ------ Linking... 1.obj : error LNK2019: unresolved external symbol "public: virtual void __thiscall CryptoPP::HexEncoder::IsolatedInitialize(class CryptoPP::NameValuePairs const &)" (? isolatedinitial...@hexencoder@CryptoPP@@uaexabvnamevaluepa...@2@@Z) referenced in function "public: __thiscall CryptoPP::HexEncoder::HexEncoder(class CryptoPP::BufferedTransformation *,bool,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?? 0hexenco...@cryptopp@@q...@pavbufferedtransformation@1...@_nhabv? $basic_str...@du?$char_traits@d...@std@@v?$alloca...@d@2@@std@@2...@z) 1.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall CryptoPP::ProxyFilter::IsolatedFlush(bool,bool)" (? isolatedfl...@proxyfilter@CryptoPP@@uae_n...@z) 1.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CryptoPP::Filter::Initialize(class CryptoPP::NameValuePairs const &,int)" (? initial...@filter@CryptoPP@@uaexabvnamevaluepa...@2@h...@z) 1.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall CryptoPP::Filter::Flush(bool,int,bool)" (? fl...@filter@CryptoPP@@uae_n_...@z) 1.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall CryptoPP::Filter::MessageSeriesEnd(int,bool)" (? messageseries...@filter@CryptoPP@@uae_n...@z) 1.obj : error LNK2001: unresolved external symbol "public: virtual unsigned __int64 __thiscall CryptoPP::BufferedTransformation::MaxRetrievable(void)const " (? maxretrieva...@bufferedtransformation@CryptoPP@@UBE_KXZ) . . . I can't understand,what is the problem at all! May I ask you help me again? Regards. Gary On Feb 9, 1:27 am, "Wei Dai" <[email protected]> wrote: > "Begin" and "Size" need to be in lower case, like "begin" and "size". > > BTW, denis bider just gave me permission to import his Guide into the Wiki > and let us update it. I'll get started with the import. > > -------------------------------------------------- > From: "Gary" <[email protected]> > Sent: Sunday, February 08, 2009 10:34 AM > To: "Crypto++ Users" <[email protected]> > Subject: Could any one help me with compiling this code correctly please? > > > > > > > Hi there! > > > I'm using Visual C++ 2008 and "CryptoPP 5.5.2" version! > > I have added this library to visual studio environment with the below > > instructions and > > > built some sample codes succesfully: > > > 1.Rename the library file from cryptlib.lib to cryptlibd.lib (notice > > the addition of the > > > "d" for Debug). > > 2.Move the Debug Library to the location of the Header and Source > > Files. Also, move > > > (without renaming) the Release version to the same folder. > > > 3-Add the location of the Header Files, Source Files, and Libraries to > > the VC++ > > > Environment. Select Tools | Options, Directories Tab. > > > 4- Add the location of the Header Files, Source Files, and Libraries > > to the VC++ Project. > > > I've compiled the code below and got 6 errors: > > > The Code: > > > // Crypto++ > > #include "sha.h" // SHA-1, SHA-256, SHA-384, SHA-512 > > #include "hex.h" // HexEncoder > > #include "files.h" > > > // std > > #include <iostream> > > #include <string.h> > > void DumpHash_SingleStep( > > CryptoPP::HashTransformation& hash, > > char const* szModuleName, > > std::string const& strData) > > { > > using namespace std; > > using namespace CryptoPP; > > > // Cannot use std::string for buffer; > > // its internal storage might not be contiguous > > AlignedSecByteBlock sbbDigest(hash.DigestSize()); > > > hash.CalculateDigest( > > sbbDigest.Begin(), > > (byte const*) strData.data(), > > strData.size()); > > > cout << szModuleName << " SS: "; > > HexEncoder(new FileSink(cout)).Put(sbbDigest.Begin(), > > sbbDigest.Size()); > > cout << endl; > > } > > void DumpHash_MultiStep( > > CryptoPP::HashTransformation& hash, > > char const* szModuleName, > > std::string const& strDataPart1, > > std::string const& strDataPart2, > > std::string const& strDataPart3) > > { > > using namespace std; > > using namespace CryptoPP; > > > hash.Update((byte const*) strDataPart1.data(), strDataPart1.size > > ()); > > hash.Update((byte const*) strDataPart2.data(), strDataPart2.size > > ()); > > hash.Update((byte const*) strDataPart3.data(), strDataPart3.size > > ()); > > > // Cannot use std::string for buffer; > > // its internal storage might not be contiguous > > AlignedSecByteBlock sbbDigest(hash.DigestSize()); > > > hash.Final(sbbDigest.Begin()); > > > cout << szModuleName << " MS: "; > > HexEncoder(new FileSink(cout)).Put(sbbDigest.Begin(), > > sbbDigest.Size()); > > cout << endl; > > } > > void DumpHash_HashFilter( > > CryptoPP::HashTransformation& hash, > > char const* szModuleName, > > std::string const& strDataPart1, > > std::string const& strDataPart2, > > std::string const& strDataPart3) > > { > > using namespace std; > > using namespace CryptoPP; > > > // Here, we are free to use std::string as the destination, > > // because StringSink uses the correct std::string interface to > > append data > > string strDigest; > > HashFilter hashFilter(hash, new StringSink(strDigest)); > > hashFilter.Put((byte const*) strDataPart1.data(), > > strDataPart1.size()); > > hashFilter.Put((byte const*) strDataPart2.data(), > > strDataPart2.size()); > > hashFilter.Put((byte const*) strDataPart3.data(), > > strDataPart3.size()); > > hashFilter.MessageEnd(); > > > cout << szModuleName << " HF: "; > > StringSource(strDigest, true, > > new HexEncoder( > > new FileSink(cout))); > > cout << endl; > > } > > void DumpHash( > > CryptoPP::HashTransformation& hash, > > char const* szModuleName, > > std::string const& strDataPart1, > > std::string const& strDataPart2, > > std::string const& strDataPart3) > > { > > DumpHash_SingleStep(hash, szModuleName, strDataPart1 + > > strDataPart2 + strDataPart3); > > DumpHash_MultiStep(hash, szModuleName, strDataPart1, > > strDataPart2, strDataPart3); > > DumpHash_HashFilter(hash, szModuleName, strDataPart1, > > strDataPart2, strDataPart3); > > } > > int main() > > { > > using namespace std; > > using namespace CryptoPP; > > > std::string strDataPart1 = "part 1; "; > > std::string strDataPart2 = "part two; "; > > std::string strDataPart3 = "PART THREE."; > > > try > > { > > DumpHash(SHA(), "SHA ", strDataPart1, > > strDataPart2, strDataPart3); > > DumpHash(SHA256(), "SHA256 ", strDataPart1, > > strDataPart2, strDataPart3); > > } > > catch (CryptoPP::Exception const& e) > > { > > cout << "CryptoPP::Exception caught: " << endl > > << e.what() << endl; > > return 1; > > } > > > return 0; > > } > > > The 6 errors: > > > ------ Build started: Project: cryptopp(hashmodule), Configuration: > > Debug Win32 ------ > > Compiling... > > 1.cpp > > d:\1.cpp(22) : error C2039: 'Begin' : is not a member of > > 'CryptoPP::SecBlock<T,A>' > > with > > [ > > T=byte, > > A=CryptoPP::AllocatorWithCleanup<byte,true> > > ] > > d:\1.cpp(27) : error C2039: 'Begin' : is not a member of > > 'CryptoPP::SecBlock<T,A>' > > with > > [ > > T=byte, > > A=CryptoPP::AllocatorWithCleanup<byte,true> > > ] > > d:\1.cpp(27) : error C2039: 'Size' : is not a member of > > 'CryptoPP::SecBlock<T,A>' > > with > > [ > > T=byte, > > A=CryptoPP::AllocatorWithCleanup<byte,true> > > ] > > d:\1.cpp(48) : error C2039: 'Begin' : is not a member of > > 'CryptoPP::SecBlock<T,A>' > > with > > [ > > T=byte, > > A=CryptoPP::AllocatorWithCleanup<byte,true> > > ] > > d:\1.cpp(51) : error C2039: 'Begin' : is not a member of > > 'CryptoPP::SecBlock<T,A>' > > with > > [ > > T=byte, > > A=CryptoPP::AllocatorWithCleanup<byte,true> > > ] > > d:\1.cpp(51) : error C2039: 'Size' : is not a member of > > 'CryptoPP::SecBlock<T,A>' > > with > > [ > > T=byte, > > A=CryptoPP::AllocatorWithCleanup<byte,true> > > ] > > > cryptopp(hashmodule) - 6 error(s), 0 warning(s) > > ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped > > ========== > > > In your opinion, why do I get these errors? > > Whereas I think errors are not reasonable,because > > "AlignedSecByteBlock" is a typedef for > > "SecBlock<byte, AllocatorWithCleanup<byte, CRYPTOPP_BOOL_X86 | > > CRYPTOPP_BOOL_X64>>" > > where "Begin" and "Size" are it's member functions! > > > Any help will be greatly appreciated! > > Gary --~--~---------~--~----~------------~-------~--~----~ 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. -~----------~----~----~----~------~----~------~--~---
