Hi Dear Geoff !
Yes,you are right,
The problem was due to my Visual Studio environment around "C runtime
library" which is now resolved.
Thank you very much;
Gary

On Feb 24, 8:26 am, Geoff Beier <[email protected]> wrote:
> On Mon, Feb 23, 2009 at 04:13, Gary <[email protected]> wrote:
>
> > I compiled the code you introduced me that was as following:
>
> > #include "secblock.h"
> > #include "files.h"
> > #include "sha.h"
> > #include "hex.h"
>
> > #include <iostream>
>
> > using namespace std;
> > using namespace CryptoPP;
> > int main(int argc, char** argv)
> > {
> >    try {
> >        if(argc < 2){
> >            cerr << "Usage: " << argv[0] << " file" << endl;
> >            return 1;
> >        }
> >        SHA1 sha;
> >        SecByteBlock outbuf(sha.DigestSize());
> >        FileSource hasher(argv[1], true, new HashFilter(sha,new ArraySink
>
> > (outbuf,outbuf.size())));
> >        cout << "SHA1(" << argv[1] << "): ";
> >        HexEncoder(new FileSink(cout)).Put(outbuf,outbuf.size());
> >        cout << endl;
> >    } catch(std::exception &e) {
> >        cerr << "Caught an exception: " << e.what() << endl;
> >        return 1;
> >    }
> >    return 0;
> > }
>
> > But I got 77 link errors as the following:
>
> I think this is a problem in your environment. I built crypto++ in
> /Users/gbeier/scratch/cryptopp552 and created my test program in
> /Users/gbeier/scratch/hashtest/hashtest.cc with the contents you give
> above. Then I used GNUMake to build the program (from within my
> hashtest directory) as follows:
>
> $ env CXXFLAGS="-I/Users/gbeier/scratch/cryptopp552"
> LDFLAGS="-L/Users/gbeier/scratch/cryptopp552 -lcryptopp" make hashtest
>
> That completes without errors, and when I run the program I get:
> $ ./hashtest hashtest.cc
> SHA1(hashtest.cc): E7B96076EE846AE1D4D3CDE80078EC716A5A9EAB
>
> For comparison, when I hash the same file using OpenSSL, I see:
> $ openssl sha1 hashtest.cc
> SHA1(hashtest.cc)= e7b96076ee846ae1d4d3cde80078ec716a5a9eab
>
> So check your environment. Make sure you've built crypto++ properly
> and your linker can find the library. I don't have a Windows machine
> handy to test on, but there's no good reason I can think of offhand
> you'd need to change any of this code for Windows... none of it is
> UNIX-specific. The build steps I took are, but they should be similar
> to what you are used to for Windows. The CXXFLAGS are just telling the
> compiler where to look for crypto++ headers and the LDFLAGS are
> telling it where the library is found and what its name is. You just
> need to build crypto++ and link against it the same way you would any
> other library.
>
> Good luck,
>
> Geoff
--~--~---------~--~----~------------~-------~--~----~
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.
-~----------~----~----~----~------~----~------~--~---

Reply via email to