Я хочу использовать библиотеки Crypto ++ в MacOS, но когда я пытаюсь создать свой код, он говорит:
clang:-1: linker command failed with exit code 1 (use -v to see invocation)
Я искал похожую решенную проблему, но не нашел ни одной.
Моя версия Apple Clang:
Apple LLVM version 9.1.0 (clang-902.0.39.2)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Вот код, который я использую:
FString UCryptoPPPluginBPLibrary::CBC_AESDecryptData(FString aes_content, FString aes_key, FString aes_IV, bool & result){
std::string sKey = TCHAR_TO_UTF8(*aes_key);
std::string sIV = TCHAR_TO_UTF8(*aes_IV);
FTCHARToUTF8 cipherText (*aes_content);
std::string outstr;
try
{
//key
SecByteBlock key(AES::MAX_KEYLENGTH);
memset(key, 0x30, key.size());
sKey.size() <= AES::MAX_KEYLENGTH ? memcpy(key, sKey.c_str(), sKey.size()) : memcpy(key, sKey.c_str(), AES::MAX_KEYLENGTH);
//iv
byte iv[AES::BLOCKSIZE];
memset(iv, 0x30, AES::BLOCKSIZE);
sIV.size() <= AES::BLOCKSIZE ? memcpy(iv, sIV.c_str(), sIV.size()) : memcpy(iv, sIV.c_str(), AES::BLOCKSIZE);
CBC_Mode<AES >::Decryption cbcDecryption((byte *)key, AES::MAX_KEYLENGTH, iv);
HexDecoder decryptor(new StreamTransformationFilter(cbcDecryption, new StringSink(outstr), BlockPaddingSchemeDef::BlockPaddingScheme::DEFAULT_PADDING,true));
decryptor.Put((byte *)cipherText.Get(), cipherText.Length());
decryptor.MessageEnd();
result = true;
}
catch (std::exception const& e)
{
outstr = "error";
UE_LOG(LogTemp, Error, TEXT("Exeption : %s"), UTF8_TO_TCHAR(e.what()));
result = false;
}
return UTF8_TO_TCHAR(outstr.c_str());
}
А вот журнал:
2/2] Link UE4Editor-CryptoPPPlugin.dylib
Undefined symbols for architecture x86_64:
"CryptoPP::Rijndael::Base::UncheckedSetKey(unsigned char const*, unsigned int, CryptoPP::NameValuePairs const&)", referenced from:
vtable for CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)1, CryptoPP::Rijndael::Dec> in Module.CryptoPPPlugin.cpp.o
"UCryptoPPPluginBPLibrary::extracted()", referenced from:
UCryptoPPPluginBPLibrary::execextracted(FFrame&, void*) in Module.CryptoPPPlugin.gen.cpp.o
"CryptoPP::Rijndael::Dec::ProcessAndXorBlock(unsigned char const*, unsigned char const*, unsigned char*) const", referenced from:
vtable for CryptoPP::BlockCipherFinal<(CryptoPP::CipherDir)1, CryptoPP::Rijndael::Dec> in Module.CryptoPPPlugin.cpp.o
...
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ERROR: UBT ERROR: Failed to produce item: /Users/naimkhader/Documents/Unreal Projects/Testing/Plugins/CryptoPPPlugin/Binaries/Mac/UE4Editor- CryptoPPPlugin.dylib
Total build time: 13.59 seconds (Local executor: 0.00 seconds)
IsЕсть кое-что, что мне нужно сделать, прежде чем я запустите этот код ...