C++ 尝试使用MinGW链接到glfw3.lib时出现问题

C++ 尝试使用MinGW链接到glfw3.lib时出现问题,c++,gcc,g++,mingw,glfw,C++,Gcc,G++,Mingw,Glfw,我试图静态链接到glfw3.lib文件,但不断出现以下错误: main.o:main.cpp:(.text+0x17): undefined reference to `glfwInit' main.o:main.cpp:(.text+0x56): undefined reference to `glfwCreateWindow' main.o:main.cpp:(.text+0x64): undefined reference to `glfwTerminate' main.

我试图静态链接到glfw3.lib文件,但不断出现以下错误:

main.o:main.cpp:(.text+0x17): undefined reference to `glfwInit'    main.o:main.cpp:(.text+0x56): undefined reference to    `glfwCreateWindow' main.o:main.cpp:(.text+0x64): undefined reference    to `glfwTerminate' main.o:main.cpp:(.text+0x76): undefined reference    to `glfwMakeContextCurrent' main.o:main.cpp:(.text+0x81): undefined    reference to `glfwWindowShouldClose' main.o:main.cpp:(.text+0x96):    undefined reference to `_imp__glClear@4'    main.o:main.cpp:(.text+0xa6): undefined reference to    `glfwSwapBuffers' main.o:main.cpp:(.text+0xab): undefined reference    to `glfwPollEvents' main.o:main.cpp:(.text+0xb2): undefined reference    to `glfwTerminate' collect2.exe: error: ld returned 1 exit status
编译器在生成目标文件时似乎没有问题,但是当我尝试将目标文件与.lib文件链接时,我得到了这个错误。 这是我使用的命令:

g++ -LC:\Desktop\CPP_WORKSPACE\OpenGl  -lglfw3  main.o -o main.exe

尝试将
-lglfw3
放在link命令的末尾。