c++ - 使用 GMP 设置 Netbeans,如何指定编译选项?

标签 c++ windows netbeans gmp

我正在尝试在 Windows 上的 Netbeans 中使用 GMP。构建失败给出输出:

cd 'C:\Users\dev1\Documents\NetBeansProjects\Simple Test'
C:\MinGW\msys\1.0\bin\make.exe -f Makefile CONF=Debug
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/dev1/Documents/NetBeansProjects/Simple Test'
"/C/MinGW/msys/1.0/bin/make.exe"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/simple_test.exe
make.exe[2]: Entering directory `/c/Users/dev1/Documents/NetBeansProjects/Simple Test'
mkdir -p dist/Debug/MinGW-Windows
g++     -o dist/Debug/MinGW-Windows/simple_test build/Debug/MinGW-Windows/main.o 
build/Debug/MinGW-Windows/main.o: In function `ZN17__gmp_binary_plus4evalEP12__mpz_structPKS0_m':
c:/mingw/include/gmpxx.h:196: undefined reference to `__gmpz_add_ui'
build/Debug/MinGW-Windows/main.o: In function 
c:/mingw/include/gmpxx.h:1497: undefined reference to `__gmpz_init'
//...same thing
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/simple_test.exe] Error 1
make.exe[2]: Leaving directory `/c/Users/dev1/Documents/NetBeansProjects/Simple Test'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/dev1/Documents/NetBeansProjects/Simple Test'
make.exe": *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 2s)

下面是我在Netbeans中修改的设置,猜猜错误在哪里

project properites

如何让 GMP 工作以便在我的源代码中使用它?

这绝对是 Netbeans 上的设置,因为我可以使用 g++ test.cpp -o test.exe -lgmpxx -lgmp

从命令行编译它

最佳答案

mathGl / MinGW undefined reference Netbeans IDE 得到这个答案

  1. 右键单击项目并转到属性

  2. 在左 Pane 中选择链接器

  3. 单击库旁边的“...”

  4. 点击“添加选项”

  5. 选择“其他选项”并输入 -lgmpxx -lgmp

  6. 点击确定

    现在应该看到... Netbeans

关于c++ - 使用 GMP 设置 Netbeans,如何指定编译选项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53592657/

相关文章:

C++ 奇怪的编译错误,严重错误

C++ 隐式转换 : good specificity or a danger on the program behavior?

java - 即使在安装和验证证书后仍出现 SSL 握手错误

apache - 你如何重置本地主机 :8084 to http://127. 0.0.1 :8084 in Tomcat files?

C++ 将全局列表传递给线程

java - 如何在按钮组中添加单选按钮?

C++ 等效于 C# 4。0's "动态“关键字?

c++ - 寻找广泛使用(大部分使用)设计模式的项目

java - 我如何获得用户音乐目录?

c++ - 为什么 Windows 不允许在模拟另一个用户时启动 WinSock