Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/158.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ GLFW未定义引用_C++_Mingw_Netbeans 7_Glfw - Fatal编程技术网

C++ GLFW未定义引用

C++ GLFW未定义引用,c++,mingw,netbeans-7,glfw,C++,Mingw,Netbeans 7,Glfw,我试图在一个项目上使用GLFW,但是当我编译它时,我会得到很多未定义的引用错误,而其中很多错误都在库文件(libglfw.a)中。 我尝试了两种方法,编译库并下载,但都没有成功。 我在netbeans上使用运行在Windows7上的MinGW和MSYS,32位。GLFW版本为2.7.3 以下是错误: "/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf make[1]: Entering di

我试图在一个项目上使用GLFW,但是当我编译它时,我会得到很多未定义的引用错误,而其中很多错误都在库文件(libglfw.a)中。 我尝试了两种方法,编译库并下载,但都没有成功。 我在netbeans上使用运行在Windows7上的MinGW和MSYS,32位。GLFW版本为2.7.3

以下是错误:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/c/Users/Raphael/Documents/NetBeansProjects/Prism'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/prism.exe
make[2]: Entering directory `/c/Users/Raphael/Documents/NetBeansProjects/Prism'
mkdir -p build/Debug/MinGW-Windows
rm -f build/Debug/MinGW-Windows/main.o.d
g++.exe    -c -g -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
mkdir -p dist/Debug/MinGW-Windows
g++.exe     -o dist/Debug/MinGW-Windows/prism build/Debug/MinGW-Windows/main.o build/Debug/MinGW-Windows/ByteBuffer.o -Lexternal -lglfw 
build/Debug/MinGW-Windows/main.o: In function `main':
C:\Users\Raphael\Documents\NetBeansProjects\Prism/main.cpp:35: undefined reference to `glMatrixMode@4'
C:\Users\Raphael\Documents\NetBeansProjects\Prism/main.cpp:36: undefined reference to `glLoadIdentity@0'
build/Debug/MinGW-Windows/main.o: In function `Z6renderv':
C:\Users\Raphael\Documents\NetBeansProjects\Prism/main.cpp:56: undefined reference to `glClearColor@16'
C:\Users\Raphael\Documents\NetBeansProjects\Prism/main.cpp:57: undefined reference to `glClear@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(window.o):window.c:(.text+0x8ae): undefined reference to `glClear@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0xe54): undefined reference to `wglGetProcAddress@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0xe6c): undefined reference to `wglGetProcAddress@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0xef6): undefined reference to `wglGetProcAddress@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0xf4f): undefined reference to `wglGetProcAddress@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0xf7f): undefined reference to `wglGetProcAddress@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x174c): undefined reference to `wglMakeCurrent@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1935): undefined reference to `wglCreateContext@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x19fe): undefined reference to `wglMakeCurrent@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1a0e): undefined reference to `wglDeleteContext@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1ea6): undefined reference to `glGetIntegerv@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1ebc): undefined reference to `glGetFloatv@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1ed8): undefined reference to `glClearColor@16'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1ee7): undefined reference to `glClear@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1f1a): undefined reference to `glClearColor@16'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(glext.o):glext.c:(.text+0x1a): undefined reference to `glGetString@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(glext.o):glext.c:(.text+0x1bf): undefined reference to `glGetIntegerv@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(glext.o):glext.c:(.text+0x1ef): undefined reference to `glGetIntegerv@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(glext.o):glext.c:(.text+0x28b): undefined reference to `glGetString@4'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(glext.o):glext.c:(.text+0x2cf): undefined reference to `glGetIntegerv@8'
c:/mingw/bin/../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_glext.o):win32_glext.c:(.text+0x7d): undefined reference to `wglGetProcAddress@4make[2]: Leaving directory `/c/Users/Raphael/Documents/NetBeansProjects/Prism'
make[1]: Leaving directory `/c/Users/Raphael/Documents/NetBeansProjects/Prism'
'
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/MinGW-Windows/prism.exe] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

CONSTRUIR FALHOU (valor da saída 2, tempo total:  1s)

你不需要链接OpenGL库吗?我没有看到
libGL
libGLU
。我知道
glClear
在链接器的
libGL
libGLU
中,在Windows,MinGW:-lglew32-lglfw3-lopengl32-lglu32-lgdi32


将libs和includes文件放在MinGW中,将dll和exes放在Windows系统文件夹中。

在我的例子中,问题不同。我在中链接opengl32,但仍然得到错误。问题是库顺序:glfw必须在opengl32之前链接

在我的例子中,这是在Code::Blocks IDE中的“Link libraries”列表框中,但在NetBeans或命令行中类似

undefined reference to `__imp_glfwInit'

修正了我改为glfw-3.3.2.bin.WIN64(64位glfw)后的问题。

@ildjarn我想这没关系。你不也需要链接OpenGL库吗?我没有看到
libGL
libGLU
。我知道
glClear
libGL
libGLU
中。作为答案发布,因为我95%确定这就是问题所在……好吧,既然这被接受为答案,那是哪一个?