I use vs code with MinGw compiler (g++)
I have this code which I copied from learnopengl. I modified the header includes to avoid errors.
The compile command is the following:
(From IDE, configured in tasks.json and copied from output stream)
C:\msys64\ucrt64\bin\g++.exe
-fdiagnostics-color=always
-g "C:\C++ projects\Opengl_test\Opengltest.cpp"
-o "C:\C++ projects\Opengl_test\Opengltest.exe" -lopengl32
lib-mingw-w64/libglfw3.a
#include "include/GLFW/glfw3.h"
int main()
{
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
//glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
return 0;
}```
Sample of Output:
```C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lib-mingw-w64/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x10f): undefined reference to `__imp_CreateDCW'C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lib-mingw-w64/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x14e): undefined reference to `__imp_GetDeviceCaps'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: lib-mingw-w64/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1a3): undefined reference to `__imp_DeleteDC'
The rest of the output is more undefined reference errors. How do I fix this?