Or for the library put a symlink to the cryptopp library in /usr/lib

Dave

-----Original Message-----
From: James Vanns [mailto:[EMAIL PROTECTED]
Sent: 08 September 2004 15:45
To: [EMAIL PROTECTED]
Subject: Re: Linker error on linux


Well, for a start you have your compiler options messed up. If you've
already set #include "../../software/crypto" as a preprocessor directive
in your code their is no need to tell the compiler it's additional
include path. If you do that you'll end up with
../../software/crypto../../software/crypto !

You need to pass it a library directory though so it can find the
cryptopp lib.

Try changing your code to:

#include "aes.h"
#include "modes.h"

and run your compiler with:

g++ -Wall -O0 -I../../software/crypto -L../../software/crypto cr.cpp -o
cr -lcryptopp

And see if that works. When you run it, and if cryptopp is a shared
library, make sure the runtime loader can find the lib to. Ensure this
by setting LD_LIBRARY_PATH correctly (export
LD_LIBRARY_PATH=$PWD/../../software/crypto or something!).

Regards

Jim Vanns

On Tue, 2004-09-07 at 19:57, Dominik Werder wrote:
> Hi all!
>
> I just wanted to try Crypto++.
> So I compiled it successfully on Linux (Slackware), gcc version 3.3.4
> I tried the following (at the bottom) simple code (it does nothing useful
> yet) from the FAQ and tried to compile it with: g++ -o test
> -I../software/crypto -lcryptopp cr.cpp 2> err
> It finds the libcryptopp.a, but gives me hundreds of linker errors,
> starting with:
>
> --- STARTING WITH ---
>
> /tmp/ccfbhSpx.o(.text+0xca): In function `void
> CryptoPP::CheckedSetKey<CryptoPP::BlockCipherFinal<(CryptoPP::Ci
> : undefined reference to
>
`CryptoPP::SimpleKeyedTransformation<CryptoPP::BlockTransformation>::ThrowIf
InvalidKey
> /tmp/ccfbhSpx.o(.text+0xde): In function `void
> CryptoPP::CheckedSetKey<CryptoPP::BlockCipherFinal<(CryptoPP::Ci
> : undefined reference to
> `CryptoPP::Rijndael::Base::UncheckedSetKey(CryptoPP::CipherDir, unsigned
> char const*,
>
/tmp/ccfbhSpx.o(.gnu.linkonce.t._ZN8CryptoPP36CipherModeFinalTemplate_Cipher
HolderINS_16BlockCipherFinalILNS_9C
> : undefined reference to `CryptoPP::CipherModeBase::SetKey(unsigned char
> const*, unsigned, CryptoPP::NameValueP
>
/tmp/ccfbhSpx.o(.gnu.linkonce.t._ZN8CryptoPP14MakeParametersIPKhEENS_19Algor
ithmParametersINS_18NullNameValuePa
> : undefined reference to `CryptoPP::g_nullNameValuePairs'
>
/tmp/ccfbhSpx.o(.gnu.linkonce.r._ZTVN8CryptoPP19AlgorithmParametersINS_18Nul
lNameValuePairsEPKhEE+0x10):
> undefi
>
/tmp/ccfbhSpx.o(.gnu.linkonce.r._ZTVN8CryptoPP36CipherModeFinalTemplate_Ciph
erHolderINS_16BlockCipherFinalILNS_
>
> ..........more here.............
>
> --- ENDING WITH ---
>
>
/tmp/ccfbhSpx.o(.gnu.linkonce.t._ZN8CryptoPP20StreamTransformationD2Ev+0xb):
> In function `CryptoPP::StreamTrans
> : undefined reference to `vtable for CryptoPP::StreamTransformation'
>
/tmp/ccfbhSpx.o(.gnu.linkonce.t._ZN8CryptoPP25SimpleKeyedTransformationINS_1
9BlockTransformationEEC2ERKS2_+0x35
> : undefined reference to `vtable for
> CryptoPP::SimpleKeyedTransformation<CryptoPP::BlockTransformation>'
>
/tmp/ccfbhSpx.o(.gnu.linkonce.t._ZN8CryptoPP25SimpleKeyedTransformationINS_1
9BlockTransformationEEC2ERKS2_+0x41
> : undefined reference to `vtable for
> CryptoPP::SimpleKeyedTransformation<CryptoPP::BlockTransformation>'
>
/tmp/ccfbhSpx.o(.gnu.linkonce.t._ZN8CryptoPP19BlockTransformationC2ERKS0_+0x
1c):
> In function `CryptoPP::BlockTr
> : undefined reference to `vtable for CryptoPP::BlockTransformation'
> collect2: ld returned 1 exit status
>
> --- END LINKER ERRORS ---
>
>
>
> /*
> Compiled with: g++ -o test -I../software/crypto -lcryptopp cr.cpp 2> err
> */
> #include "../software/crypto/modes.h"
> #include "../software/crypto/aes.h"
> #include <stdlib.h>
> #include <iostream>
>
> using namespace CryptoPP;
>
> int main(int argc, char** argv) {
>    byte key[AES::DEFAULT_KEYLENGTH];
>    byte iv[AES::BLOCKSIZE];
>    {
>      for (int i=0; i<AES::DEFAULT_KEYLENGTH; i++) {
>        key[i]=0x00;
>      }
>    }
>    CFB_Mode<AES >::Encryption cfbEncryption(key, AES::DEFAULT_KEYLENGTH,
> iv); // Error here ???
>    return 0;
> }
>
>
>
>
> could anybody help me with this??? I tried for two days now...
>
> bye!
> Dominik
--
James Vanns BSc (Hons) MCP
Senior Software Engineer (Linux / C & C++)
Canterbury Christ Church University College
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x24045370




Reply via email to