首页 > 解决方案 > 未解析的外部符号“公共:静态浮点 __cdecl RSA::encrypt_or_decrypt(float,float,float)”(?encrypt_or_decrypt@RSA@@SAMMMM@Z)

问题描述

我无法让应用程序使用我制作的 c++ 库。

该库位于https://github.com/Coder4360/RSA/

该程序称为 RSA Test,我无法构建它(我使用的是 Visual Studio 2019):

问题可能在这里:

RSAlib.h:

#pragma once

#ifdef RSALIB_EXPORTS
#define MATHLIBRARY_API __declspec(dllexport)
#else
#define RSALIB_API __declspec(dllimport)
#endif

extern "C" RSALIB_API float generate_encryption_number(float prime_1, float prime_2);
extern "C" RSALIB_API float generate_decryption_number(float prime_1, float prime_2, float public_exponent);
extern "C" RSALIB_API float encrypt_or_decrypt(float data, float exponent, float encryption_number);

class RSA
{
public:
    static float generate_encryption_number(float prime_1, float prime_2);
    static float generate_decryption_number(float prime_1, float prime_2, float public_exponent);
    static float encrypt_or_decrypt(float data, float exponent, float encryption_number);
};

RSA 测试.cpp

// RSA Test.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include "RSAlib.h"

using namespace std;

int main()
{
    float encrypted = RSA::encrypt_or_decrypt(20, 3, 3127);
    float decrypted = encrypt_or_decrypt(encrypted, 2011, 3127);
    cout << "Encrypted: " << encrypted << endl;
    cout << "Decrypted: " << decrypted << endl;
    return 0;
}

标签: c++encryptionrsalibraries

解决方案


推荐阅读