मैं C++ linux में crypto ++ का उपयोग कर रहा हूं।CryptoPP :: AlignedAllocate (हस्ताक्षरित 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)'
मैं इस त्रुटि को कैसे ठीक कर सकता हूं? क्या मेरे कोड में कुछ गड़बड़ है?
मैं क्रिप्टो स्थापित करने हूँ ++ इस पैकेज के लिए Synaptic पैकेज प्रबंधक का उपयोग कर:।।
libcrypto++-utils
libcrypto++8
libcrypto++8-dbg
libcrypto++-dev
libcrypto++-doc
और libcrypto ++ एक और libcrypto ++ तो में पहले से/usr/lib/
धन्यवाद पाया जा सकता है।
मैंने कोशिश उपयोग छ ++ संकलित करने के लिए, लेकिन अभी भी वहाँ जो त्रुटि। मुझे क्या सी ++ कोड लिंक करना चाहिए? धन्यवाद। – user1533464
मुझे विश्वास AlignedAllocate (अहस्ताक्षरित int) क्रिप्टो ++/secblock.h कि क्रिप्टो ++/misc.h जहां AlignedAllocate (अहस्ताक्षरित int) घोषित किया जाता है, लेकिन किसी भी तरह AlignedAllocate (अहस्ताक्षरित int) कार्यान्वयन नहीं मिला है, और इस त्रुटि हुई शामिल में इस्तेमाल किया। मुझे क्या करना चाहिए? – user1533464
मैंने अपने प्रोग्राम में क्रिप्टो ++/misc.h को शामिल करने का प्रयास किया है, लेकिन उन त्रुटियों को अभी भी ठीक किया गया है। – user1533464