【发布时间】:2019-09-29 14:02:54
【问题描述】:
当我尝试在 Botan C++ 中创建 RSA_PrivateKey 对象时,编译器抱怨对 std::thread::_State::~_State() 的未定义引用。
#include <QCoreApplication>
#include <botan/rsa.h>
#include <botan/auto_rng.h>
#include <iostream>
using std::cout;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
std::unique_ptr<Botan::RandomNumberGenerator> rng(new Botan::AutoSeeded_RNG);
cout << rng->name();
// this line caused the error
std::unique_ptr<Botan::RSA_PrivateKey> theKey(new Botan::RSA_PrivateKey(*rng.get(),1024));
return a.exec();
}
错误显示如下: Error when creating RSA_PrivateKey in Botan
我真的不确定编译器为什么会抱怨。我需要帮助,在此先感谢。
我使用“.a”文件将植物库添加为静态库。我通过右键单击项目文件夹 > 添加库 > 外部库来做到这一点。我尝试在调试中编译。
操作系统:Windows 7
编译器:Qt 5.11.2 MinGW 32-bit
【问题讨论】:
-
所有东西都是用相同的编译器和相同的设置编译的吗?没有QT,只要标准库+Botan,你能产生这个错误吗?
-
你的意思是在其他 IDE 中做同样的事情,比如 Code::Blocks?
-
是的,相同的编译器和设置
-
我认为这与 Botan 无关。我认为这与 std::thread (我认为它是由 Qt 引入的)有关。如果
main只是{return QCoreApplication(argc,argv).exec(); }会发生什么? -
不,我不认为 Fire Lancer 意味着“在其他 IDE 中做同样的事情”。他的意思是“静态库是如何生成的”?是相同的编译器和设置吗?