You are not logged in.
Does anyone know why this code
#include <iostream>
#include <string>
#include <iomanip>
#include "cryptopp/osrng.h"
using namespace std;
int main() {
const unsigned int BLOCKSIZE = 16*8;
byte * pcbScratch = (byte *)calloc(BLOCKSIZE, sizeof(byte)); // Same error happens with byte pcbScratch[BLOCKSIZE]
CryptoPP::AutoSeededRandomPool rng;
rng.GenerateBlock(pcbScratch, BLOCKSIZE);
for(unsigned int i = 0; i < BLOCKSIZE; i++) {
cout << *(pcbScratch+i);
}
return 0;
}
would cause this error?
g++ TestClass.cpp
/tmp/cc7wp4jU.o: In function `main':
TestClass.cpp:(.text+0x202): undefined reference to `CryptoPP::RandomNumberGenerator::GenerateBlock(unsigned char*, unsigned int)'
Last edited by rwdalpe (2011-06-15 03:22:30)
Offline
That would be a linker error. How are you making this and do you want to share your class declaration with us?
BTW this is a bit odd for a first post. Could you give us some background about you?
Last edited by ewaller (2011-06-15 03:02:32)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
Sure thing!
I used to post on the forum under the username l33tunderground, but have since decided I would rather go with a less childish username.
To be honest, I just started a project in Eclipse and attempted to include the Crypto++ libraries, which I installed through pacman. I don't know if there's anything special I need to do to properly include the library, as the Crypto++ documentation is painfully lacking in basics.
Edit: Shameless plug to the Arch forums
I've found in the past that Arch users are incredibly reliable and helpful, so I posted here rather than a traditional programming forum.
Last edited by rwdalpe (2011-06-15 03:13:22)
Offline
Bah! Shame on me for not finding this sooner.
My issue was solved with
g++ TestClass.cpp -lcryptopp -lpthread
Offline
class CRYPTOPP_DLL BlockingRng : public RandomNumberGenerator
{
public:
BlockingRng();
~BlockingRng();
void GenerateBlock(byte *output, size_t size);
protected:
int m_fd;
};
and
CryptoPP::RandomNumberGenerator::GenerateBlock(unsigned char*, unsigned int)
That should be okay.
But you do need to link to /usr/lib/libcryptopp.a or to /usr/lib/libcryptopp.so
Edit: Never Mind. Glad you solved it.
Last edited by ewaller (2011-06-15 03:31:24)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline