我在Netbeans中编写这个简单的程序。
#include <stdio.h>
#include <gmp.h>
using namespace std;
int main(int argc, char** argv) {
mpf_t a,b,c;
mpf_init(a);
return 0;
}
我得到的错误是:
gmake[2]: Entering directory `/mnt/home/arigi/test/xx'
mkdir -p dist/Release/GNU-Linux-x86
g++ -o dist/Release/GNU-Linux-x86/xx build/Release/GNU-Linux-x86/main.o -L../../lib -Wl,-rpath,../../lib
build/Release/GNU-Linux-x86/main.o: In function `main':
main.cpp:(.text+0x38): undefined reference to `__gmpf_init'
collect2: ld returned 1 exit status
gmake[2]: *** [dist/Release/GNU-Linux-x86/xx] Error 1
gmake[2]: Leaving directory `/mnt/home/arigi/test/xx'
gmake[1]: *** [.build-conf] Error 2
gmake[1]: Leaving directory `/mnt/home/arigi/test/xx'
gmake: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 253ms)
我试过mpfr而且我得到了同样的错误。当我删除
mpf_init(a);
编译成功。很感谢任何形式的帮助。