SASUPERNOVA
SASUPERNOVA

Reputation: 141

Linker error when printing MPIR mpf_class

I am trying to use the MPIR library in a Qt Project. Here is a code snippet:

#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();
}

The above code compiles without any issues. However, when I try to print the value of the mpf_class like this:

std::cout << z;

I get the following error:

main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) class 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) referenced in function main

In case it helps, I built the libraries using the following commands in the X64 bit version of MSYS2:

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

Upvotes: 2

Views: 112

Answers (0)

Related Questions