C 构建GLFW/OpenGL程序时未定义的引用?

C 构建GLFW/OpenGL程序时未定义的引用?,c,gcc,opengl,mingw,glfw,C,Gcc,Opengl,Mingw,Glfw,我正在尝试使用C、MINGW和GLFW创建一个程序,在编译时不断出现这个错误 cc1.exe: warning: unrecognized gcc debugging option: y cc1.exe: warning: unrecognized gcc debugging option: n cc1.exe: warning: unrecognized gcc debugging option: m cc1.exe: warning: unrecognized gcc debugging o

我正在尝试使用C、MINGW和GLFW创建一个程序,在编译时不断出现这个错误

cc1.exe: warning: unrecognized gcc debugging option: y
cc1.exe: warning: unrecognized gcc debugging option: n
cc1.exe: warning: unrecognized gcc debugging option: m
cc1.exe: warning: unrecognized gcc debugging option: i
cc1.exe: warning: unrecognized gcc debugging option: c
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x127): undefined reference to `CreateDCW@16'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x160): undefined reference to `GetDeviceCaps@8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x179): undefined reference to `GetDeviceCaps@8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1ca): undefined reference to `GetDeviceCaps@8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x24b): undefined reference to `GetDeviceCaps@8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x291): undefined reference to `DeleteDC@4'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x9ee): undefined reference to `GetDeviceCaps@8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xa07): undefined reference to `GetDeviceCaps@8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xe9f): undefined reference to `CreateDCW@16'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xeba): undefined reference to `GetDeviceGammaRamp@8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xec8): undefined reference to `DeleteDC@4'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x100e): undefined reference to `CreateDCW@16'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1029): undefined reference to `SetDeviceGammaRamp@8'
./libs/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1037): undefined reference to `DeleteDC@4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x1f3): undefined reference to `CreateDIBSection@24'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x262): undefined reference to `CreateBitmap@20'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x28d): undefined reference to `DeleteObject@4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x37b): undefined reference to `DeleteObject@4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x389): undefined reference to `DeleteObject@4'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xb55): undefined reference to `CreateRectRgn@16'
./libs/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xc2c): undefined reference to `DeleteObject@4'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x6c4): undefined reference to `DescribePixelFormat@16'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xbbd): undefined reference to `DescribePixelFormat@16'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xf46): undefined reference to `SwapBuffers@4'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1254): undefined reference to `ChoosePixelFormat@8'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x126f): undefined reference to `SetPixelFormat@12'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1592): undefined reference to `DescribePixelFormat@16'
./libs/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x15d9): undefined reference to `SetPixelFormat@12'
collect2.exe: error: ld returned 1 exit status
这是我的密码

#include "GLFW/glfw3.h"
#include <stdio.h>

#define GLFW_INCLUDE_GLCOREARB

int main() {
    GLFWwindow* window;

    if (!glfwInit()) return -1;

    window = glfwCreateWindow(640, 480, "Test", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        return -1;
    }

    glfwMakeContextCurrent(window);

    while (!glfwWindowShouldClose(window))
    {
        glClear(GL_COLOR_BUFFER_BIT);

        glfwSwapBuffers(window);

        glfwPollEvents();
    }

    glfwTerminate();
    return 0;
}

我在编译glfw时没有任何问题,但我在GLEW方面有问题,可能是因为它是lib文件而不是a.

,正如您所看到的,它无法识别
-dynamic
选项。你为什么把它放在那里?您是否在文档中的任何地方看到过它?您是指
-rdynamic
?当我删除-dynamic时,我仍然有相同的问题,只是没有无法识别的调试选项…为什么您要像使用
-L
一样使用
-I
?我做了关于我包含的头所在位置的bcs,我可能会很快更改它,使其更整洁。
gcc -o Test.o Main.c -IGLFW -IGL -dynamic ./libs/glfw3.dll ./libs/glew32.dll -lopengl32 -static ./libs/libglfw3.a ./libs/glew32.lib ./libs/glew32s.lib