本文介绍了GLFW未定义参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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



这些是错误:

  make [1]:输入目录`/ c / Users / Raphael / Documents / NetBeansProjects / Prism'
/ usr / bin / make-f nbproject / Makefile-Debug.mk dist / Debug / MinGW-Windows / prism.exe
make [2]:输入目录`/ c / Users / Raphael / Documents / NetBeansProjects / Prism'
mkdir -p build / Debug / MinGW-Windows
rm -f build / Debug / MinGW-Windows / main.od
g ++。exe -c -g-MMD -MP -MF build / Debug / MinGW-Windows / main.od -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:在函数`main'中:
C:\Users\Raphael\Documents\NetBeansProjects\Prism / main.cpp:35:未定义引用`glMatrixMode @ 4 '
C:\Users\Raphael\Documents\NetBeansProjects\Prism / main.cpp:36:未定义引用`glLoadIdentity @ 0'
build / Debug / MinGW-Windows / main .o:在函数`Z6renderv'中:
C:\Users\Raphael\Documents\NetBeansProjects\Prism/ main.cpp:56:未定义引用`glClearColor @ 16'
C :\Users\Raphael\Documents\NetBeansProjects\Prism / main.cpp:57:未定义引用`glClear @ 4'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(window.o):window.c :(。text + 0x8ae):未定义的引用`glClear @ 4'
c:/ mingw / bin /../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0xe54):未定义引用`wglGetProcAddress @ 4 '
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(win32_window.o):win32_window.c :(。 0xe6c):未定义引用`wglGetProcAddress @ 4'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(win32_window.o ):win32_window.c :(。text + 0xef6):未定义的引用`wglGetProcAddress @ 4'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../ ../libglfw.a(win32_window.o):win32_window.c:(.text+0xf4f):未定义引用`wglGetProcAddress @ 4'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(win32_window.o):win32_window.c :(。+ 0xf7f):未定义引用`wglGetProcAddress @ 4'
c:/ mingw / bin /../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x174c):未定义引用`wglMakeCurrent @ 8 '
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(win32_window.o):win32_window.c :(。 0x1935):未定义引用`wglCreateContext @ 4'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(win32_window.o ):win32_window.c :(。text + 0x19fe):未定义的引用`wglMakeCurrent @ 8'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../ ../libglfw.a(win32_window.o):win32_window.c:(.text+0x1a0e):未定义的引用`wglDeleteContext @ 4'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(win32_window.o):win32_window.c :(。text + 0x1ea6):未定义引用`glGetIntegerv @ 8'
c:/ mingw / bin /../lib/gcc/mingw32/4.6.1/../../../libglfw.a(win32_window.o):win32_window.c:(.text+0x1ebc):未定义的引用`glGetFloatv @ 8 '
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(win32_window.o):win32_window.c :(。 0x1ed8):未定义引用`glClearColor @ 16'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(win32_window.o ):win32_window.c :(。text + 0x1ee7):未定义的引用`glClear @ 4'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../ ../libglfw.a(win32_window.o):win32_window.c:(.text+0x1f1a):未定义引用`glClearColor @ 16'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(glext.o):glext.c :(。text + 0x1a):未定义的引用`glGetString @ 4'
c:/ mingw / bin /../lib/gcc/mingw32/4.6.1/../../../libglfw.a(glext.o):glext.c:(.text+0x1bf):未定义的引用`glGetIntegerv @ 8 '
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(glext.o):glext.c :(。 0x1ef):未定义引用`glGetIntegerv @ 8'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(glext.o ):glext.c :(。text + 0x28b):未定义引用`glGetString @ 4'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../ ../libglfw.a(glext.o):glext.c:(.text+0x2cf):未定义引用`glGetIntegerv @ 8'
c:/ mingw / bin /../ lib / gcc / mingw32 / 4.6.1 /../../../ libglfw.a(win32_glext.o):win32_glext.c :(。text + 0x7d):未定义引用`wglGetProcAddress @ 4make [2]:离开目录`/ c / Users / Raphael / Documents / NetBeansProjects / Prism'
make [1]:离开目录`/ c / Users / Raphael / Documents / NetBeansProjects / Prism'
'
collect2:ld返回1 exit状态
make [2]:*** [dist / Debug / MinGW-Windows / prism.exe]错误1
make [1]:*** [.build-conf] Error 2
make:*** [.build-impl]错误2

CONSTRUIR FALHOU(valor dasaída2,tempo total:1s)


解决方案

你不必链接OpenGL库吗?我没有看到 libGL libGLU 。我知道 glClear libGL libGLU / p>

I'm trying to use GLFW on a project, but when I compile it, I get a lot of undefined reference errors, while many of them is on the library file (libglfw.a).I tried both, compile the library and download it, but without success.I'm using MinGW and MSYS running on Windows 7 32-bits on netbeans. The GLFW version is 2.7.3;

These are the errors:

"/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)
解决方案

Don't you have to link the OpenGL libs as well? I don't see libGL or libGLU. I know glClear is in either libGL or libGLU.

这篇关于GLFW未定义参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 21:36