gpt4 book ai didi

c++ - 在 Window 中的 NetBeans 上设置 OpenGL

转载 作者:太空宇宙 更新时间:2023-11-04 13:21:59 24 4
gpt4 key购买 nike

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

我想使用 GLEWGLFW 库,所以我下载了它们并创建了一个 include 文件夹,我在其中存储了所有 .h 文件和一个 libs 文件夹我在其中存储了 glew32.libglfw3.lib。我通过设置

在 NetBeans 中包含了 include 文件夹

项目属性>构建>C++编译器>包含目录

并且我通过设置

在 NetBeans 中包含了 bin 文件夹

项目属性>构建>链接器>库

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

cd 'D:\Documenti\NetBeansProjects\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 `/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>当你编译/链接时。

关于c++ - 在 Window 中的 NetBeans 上设置 OpenGL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34932872/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com