#Please help with Opengl and glfw

2 messages · Page 1 of 1 (latest)

torn terrace
#

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?

hearty wolfBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.