2

Qt プロジェクトでMPIRライブラリを使用しようとしています。コード スニペットを次に示します。

#include <QCoreApplication>
#include <iostream>
#include "mpir.h"
#include "mpirxx.h"

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    mpf_class x, y, z;

    x = "4325345345634534535345345";
    y = "45";
    z = x - y;

    return a.exec();
}

上記のコードは問題なくコンパイルされます。ただし、次のように mpf_class の値を出力しようとすると:

std::cout << z;

次のエラーが表示されます。

main.obj:-1: エラー: LNK2019: 未解決の外部シンボル "__declspec(dllimport) クラス std::basic_ostream > & __cdecl operator<<(class std::basic_ostream > &,struct __mpf_struct const *)" (__imp_??6 @YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@std@@AEAV01@PEBU__mpf_struct@@@Z) 関数 main で参照

それが役立つ場合は、 MSYS2の X64 ビット バージョンで次のコマンドを使用してライブラリをビルドしました。

./configure --disable-static --enable-shared --enable-cxx
make
4

0 に答える 0