在窗口中的 NetBeans 上设置 OpenGL



我正在尝试在Netbeans 8.1中设置OpenGL。我已经安装了MinGW作为编译器C++它可以工作。

我想使用 GLEW 和 GLFW 库,所以我下载了它们,并创建了一个包含文件夹,其中存储了所有 .h 文件,还有一个 libs 文件夹,其中存储了 glew32.lib 和 glfw3.lib我已经在 NetBeans 中通过设置

>生成> C++编译器>包含目录的项目属性

并且我已经通过设置

>生成>链接器>库的项目属性

然后在我的主文件中.cpp我已经插入了 GLEW 和 GLFW 的包含,但是当我执行 mi 文件时,这让我得到这个输出错误

cd 'D:DocumentiNetBeansProjectsTest'
C:MinGWmsys1.0binmake.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 `/d/Documenti/NetBeansProjects/Test'
"/C/MinGW/msys/1.0/bin/make.exe"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/test.exe
make.exe[2]: Entering directory `/d/Documenti/NetBeansProjects/Test'
mkdir -p dist/Debug/MinGW-Windows
g++     -o dist/Debug/MinGW-Windows/test build/Debug/MinGW-Windows/main.o -l glew32 -lglfw3
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lglew32
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lglfw3
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/test.exe] Error 1
make.exe[2]: Leaving directory `/d/Documenti/NetBeansProjects/Test'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/d/Documenti/NetBeansProjects/Test'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)

有谁知道如何解决这个问题?

链接器找不到您的库,因为您没有告诉 NetBeans 存储这些库的目录。请前往:

Project Properties -> Linker -> Additional Library Directories

并将此目录添加到 NetBeans 项目中。之后,您将在编译/链接时-L<path>看到其他链接器选项。

最新更新