crypto++を使用してプロジェクトをコンパイルしようとしています。私のプロジェクトはclrを使用しており、コードをコンパイルしようとすると、次のエラーが発生します。
'main' : this function cannot be compiled as managed, consider using #pragma unmanaged
'int main(cli::array<Type> ^)' : managed type or function cannot be used in an unmanaged function
私のプロジェクトはを使用しており、ランタイムライブラリとしてclr
使用しています。/MD
crypto++をコンパイルしたときに同じパラメータを設定しました。
編集:私の主な機能
int main(array<System::String ^> ^args)
{
Console::WriteLine(L"Hello World");
// Generate keys
AutoSeededRandomPool rng;
InvertibleRSAFunction params;
params.GenerateRandomWithKeySize( rng, 1536 );
RSA::PrivateKey privateKey( params );
RSA::PublicKey publicKey( params );
std::string plain="RSA Encryption", cipher, recovered;
// Encryption
RSAES_OAEP_SHA_Encryptor e( publicKey );
StringSource( plain, true,
new PK_EncryptorFilter( rng, e,
new StringSink( cipher )
) // PK_EncryptorFilter
); // StringSource
// Decryption
RSAES_OAEP_SHA_Decryptor d( privateKey );
StringSource( cipher, true,
new PK_DecryptorFilter( rng, d,
new StringSink( recovered )
) // PK_DecryptorFilter
); // StringSource
assert( plain == recovered );
std::cin.ignore();
return 0;
}