I’m trying to compile my code, but getting errors.
Source code:
#include <GLFW/glfw3.h>
int main()
{
if (glfwInit()) glfwTerminate();
return 0;
}
Command line:
gcc main.cpp -IC:\libs\GLFW\include -LC:\libs\GLFW\libs\lib-mingw\x86 -lglfw3 -lgdi32
Output:
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(init.c.obj):init.c:(.text+0xb9): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(init.c.obj):init.c:(.text+0xda): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(init.c.obj):init.c:(.text+0x11c): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(init.c.obj):init.c:(.text+0x2bf): undefined reference to `__mingw_realloc'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(input.c.obj):input.c:(.text+0x1016): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(input.c.obj):input.c:(.text+0x1021): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(input.c.obj):input.c:(.text+0x102c): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(input.c.obj):input.c:(.text+0x242c): undefined reference to `__mingw_realloc'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(input.c.obj):input.c:(.text+0x17f6): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0xc2): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0xd0): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0xde): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0x114): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0x122): more undefined references to `__mingw_free' follow
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0x2bd): undefined reference to `__mingw_realloc'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0x392): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0x3a0): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0x3ae): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0x3e4): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0x3f2): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(monitor.c.obj):monitor.c:(.text+0x400): more undefined references to `__mingw_free' follow
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xe46): undefined reference to `__mingw_realloc'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x1091): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x10c9): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x10d9): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x202d): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x23a5): undefined reference to `__mingw_free'
C:\libs\GLFW\libs\lib-mingw\x86/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x521c): more undefined references to `__mingw_free' follow
collect2.exe: error: ld returned 1 exit status
GLFW version: 3.3.9 x86 (precompiled)
Operating system: Windows 11 x64
Compiler: MinGW x86