您好,我想使用Qt-creator创建一个Qt5项目,并想使用mpfr / gmp,所以我需要如何配置该项目。
因为如果我编译,我会得到这些错误:
#include "mainwindow.h"
#include <QApplication>
#include <stdio.h>
#include <gmp.h>
#include <mpfr.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
mpfr_t x, y, z, t;
mpfr_inits2 (256, x, y, z, t, (mpfr_ptr) 0);
return a.exec();
}
输出:
error: undefined reference to `mpfr_inits2'
但是在代码块上,我添加了包含路径和库路径,并向编译器添加了标志-lgmp -lmpfr
,并且可以正常工作。