所以最近我开始了一个涉及 GLFW(64 位,带有 GLEW)的项目。但是,我似乎无法正确链接。这是我的设置方式:
操作系统:Windows 8 64 位
编译器:mingw64
IDE:日食
我的简单测试程序:
#include <stdio.h>
#include <stdlib.h>
#define GLEW_STATIC
#include <gl/glew.h>
#include <gl/glfw3.h>
int main(void) {
glfwInit();
puts("Hello, World!");
return (EXIT_SUCCESS);
}
我如何设置链接:http: //i.imgur.com/yyISNtZ.png
错误(注意这些仅在引用任何 GLFW 函数时发生。它们不会通过简单地包含标头而发生):
13:33:00 **** Incremental Build of configuration Release for project MementoLibrary ****
Info: Internal Builder is used for build
gcc -O3 -Wall -c -fmessage-length=0 -o "src\\MementoLibrary.o" "..\\src\\MementoLibrary.c"
gcc -o MementoLibrary.exe "src\\MementoLibrary.o" -lglfw3 -lglew32s -lopengl32
c:/mingw64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/lib/../lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x2a7): undefined reference to `__imp_CreateDCW'
c:/mingw64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/lib/../lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x2e9): undefined reference to `__imp_GetDeviceCaps'
c:/mingw64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/lib/../lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x2fb): undefined reference to `__imp_GetDeviceCaps'
c:/mingw64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/lib/../lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x31e): undefined reference to `__imp_DeleteDC'
c:/mingw64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: c:/mingw64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/lib/../lib/libglfw3.a(win32_monitor.c.obj): bad reloc address 0x0 in section `.pdata'
collect2.exe: error: ld returned 1 exit status