MinGW:对所有GLFW函数调用的未定义引用

时间:2014-06-17 19:47:55

标签: g++ cmake mingw

MinGW似乎在查找我的GLFW库时遇到问题,尽管它可以很好地找到我的头文件。我的文件位置如下:

标题:C:\MinGW\include\GLFW\glfw3.h

图书馆:C:\MinGW\lib\glfw3dll.aC:\MinGW\lib\libglfw3.a

DLL:C:\Windows\SysWOW64\glfw3.dll

我使用Code :: Blocks和MinGW-gcc / g ++作为编译器,但命令行等价物将是这样的:

   mingw32-g++ -Wall -o tutorial01 tutorial01.cpp -lOpenGL32 -lglu32 -lglfw3

编译器然后抱怨它找不到任何GLFW函数,即使它们已在头文件中列出:

undefined reference to `glfwInit'
undefined reference to `glfwWindowHint'
undefined reference to `glfwWindowHint'
undefined reference to `glfwWindowHint'
undefined reference to `glfwWindowHint'
undefined reference to `glfwCreateWindow'
undefined reference to `glfwTerminate'
undefined reference to `glfwMakeContextCurrent'
undefined reference to `_imp__glewInit@0'
undefined reference to `glfwSetInputMode'
undefined reference to `glfwSwapBuffers'
undefined reference to `glfwPollEvents'
undefined reference to `glfwGetKey'
undefined reference to `glfwWindowShouldClose'
undefined reference to `glfwTerminate'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe:
C:\...\AppData\Local\Temp\ccIzMr4L.o: bad reloc address 0x20 in section `.eh_frame'
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status

我还尝试将DLL和lib包含在他们的32位等效文件夹中,但也没有修复任何内容。

更新:这是我的nm输出。我相信它确实包含glfwInit,除非我不正确地阅读此内容:

nm -D .\libglfw3.a
clipboard.c.obj: File format not recognized
context.c.obj: File format not recognized
gamma.c.obj: File format not recognized
init.c.obj: File format not recognized
input.c.obj: File format not recognized
joystick.c.obj: File format not recognized
monitor.c.obj: File format not recognized
time.c.obj: File format not recognized
window.c.obj: File format not recognized
win32_clipboard.c.obj: File format not recognized
win32_gamma.c.obj: File format not recognized
win32_init.c.obj: File format not recognized
win32_joystick.c.obj: File format not recognized
win32_monitor.c.obj: File format not recognized
win32_time.c.obj: File format not recognized
win32_window.c.obj: File format not recognized
wgl_context.c.obj: File format not recognized

0 个答案:

没有答案