问题描述
我目前正在尝试使用这个用于 c++14 的 BitInt 库来执行更大的计算。
https://faheel.github.io/BigInt/
每次两个 BitInt 相乘都会出现一个错误。 我重新安装了 Visual Studio 和底层编译器,并且运行的是最新版本。
错误信息
The thread 0x2918 has exited with code 0 (0x0).
Exception thrown at 0x00007FFDA337F530 (ucrtbased.dll) in MyProg.exe: 0xC0000005: Access violation reading location 0x00007FF8A3E3A84F.
这是我的代码
#include <iostream>
#include "../BigInt/BigInt.hpp"
int main()
{
BigInt big1,big2;
big1 = "2";
big2 = "9876543210123456789098765432101234567890";
std::cout << (big1 * big2).to_string();
// std::cout << big1 * big2 * 123456 << "\n";
return 0;
}
截图
This is a screenshot of the file the error is in
解决方法
并非所有开源软件都能正常运行。很遗憾。这看起来像是您使用的库中的错误。我建议在图书馆的 GitHub 存储库上发布一个问题。之后,如果您愿意,您也可以尝试调试库内部,进行修复并将带有修复的 PR 发布回库。否则,我建议使用更多经过时间验证的库,例如 Crypto++。