C++ linux에서 crypto ++을 사용하고 있습니다. 내가 그것을 실행하면 몇 가지 오류가 발생CryptoPP :: AlignedAllocate (unsigned int)에 대한 정의되지 않은 참조
#include <iostream>
#include <fstream>
#include <string.h>
#include "crypto++/cryptlib.h"
#include "crypto++/modes.h"
#include "crypto++/filters.h"
#include "crypto++/aes.h"
#include "crypto++/osrng.h"
#include "crypto++/strciphr.h"
using namespace std;
using namespace CryptoPP;
ifstream::pos_type size;
char * memblock;
int length;
char * _iv[AES::BLOCKSIZE];
char * keys[AES::MAX_KEYLENGTH];
void encriptCTR(byte * outbyte, const byte * inbyte, const byte * key, const byte * iv);
void encriptCTR(byte * outbyte, const byte * inbyte, const byte * key, const byte * iv)
{
size_t inbyte_len = strlen((const char *)inbyte);
CTR_Mode<AES>::Encryption ctr_encription(key, strlen((const char*)key), iv);
ctr_encription.ProcessData(outbyte, inbyte, inbyte_len);
}
int main()
{
ifstream file;
file.open("testaja", ios::binary);
if (file.is_open())
{
file.seekg (0, ios::end);
length = file.tellg();
memblock = new char [length];
file.seekg (0, ios::beg);
file.read (memblock, length);
if (!file)
{
int a;
a = (int)file.gcount();
file.clear();
}
else
{
file.close();
for (int i = 0; i < length; ++i)
{
cout << hex << (int)memblock[i] << " ";
}
}
}
}
: 여기 내 간단한 코드입니다
undefined reference to `CryptoPP::AlignedAllocate(unsigned int)'
undefined reference to `CryptoPP::UnalignedAllocate(unsigned int)'
undefined reference to `CryptoPP::AlignedDeallocate(unsigned int)'
undefined reference to `CryptoPP::UnalignedDeallocate(unsigned int)'
을 다음, 나는 명령
gcc -o test test.cpp -L/usr/lib/crypto++ -lcrypto++
을 사용하지만, 여전히이 오류 :
undefined reference to `CryptoPP::AlignedAllocate(unsigned int)'
undefined reference to `CryptoPP::UnalignedAllocate(unsigned int)'
undefined reference to `CryptoPP::AlignedDeallocate(unsigned int)'
undefined reference to `CryptoPP::UnalignedDeallocate(unsigned int)'
어떻게이 오류를 해결할 수 있습니까? 내 코드에 문제가 있습니까?
나는이 패키지에 대한 시냅스 패키지 관리자를 사용하여 ++ 암호화를 설치하고있다 :..
libcrypto++-utils
libcrypto++8
libcrypto++8-dbg
libcrypto++-dev
libcrypto++-doc
및 libcrypto ++ a와 libcrypto는 ++ 그래서 미리는/usr/lib 디렉토리/
감사에서 찾을 수 있습니다.
내가 사용 g ++ 컴파일하지만, 여전히 그 오류를 시도했다. 어떤 C++ 코드를 링크해야합니까? 감사. – user1533464
AlignedAllocate (unsigned int)는 Crypto ++/secblock.h에 AlignedAllocate (unsigned int)가 선언되었지만 AlignedAllocate (unsigned int) 구현을 찾을 수 없으며이 오류가 발생하는 ++/misc.h를 포함한다고 생각합니다. 나는 어떻게해야합니까? – user1533464
내 프로그램에 crypto ++/misc.h를 포함 시키려고했지만 오류가 계속 발생합니다. – user1533464