在 Fedora 31 上安装 mpir-3.0 之后。现在我尝试构建项目:
#include <stdio.h>
#include <gmp.h>
#include <mpir.h>
#include <mpfr.h>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
mpf_t a; //mpir float variable
mpf_init(a); //initialise a
mpir_ui two = 2; //mpir unsigned integer variable
FILE* stream; //file type pointer to output on standard output (console)
mpf_init_set_ui (a, 2); //set value of a to 2
mpf_out_str (stream, 10, 2, a); //output value of a
cout << "\nMPIR working" << "\n" ;
}
但是当我编译它时,我得到了这个错误:
‘mpir_ui’ was not declared in this scope; did you mean ‘mpfr_ai’?|
我已经使用了这些标志:
-lmpir -lmpfr -lgmp