ImGui don't recognize FreeGLUT?

83 Views Asked by At

I am endeavoring to configure Visual Studio Code using the Python compiler with ImGui and freeglut.

In accordance with the official guidelines, I have configured C++ on Visual Studio Code utilizing MinGW, which includes gcc, g++, and gdb. ( https://code.visualstudio.com/docs/cpp/config-mingw )

Subsequently, I set up OpenGL with Visual Studio Code (I utilized GLUT and GLEW). At this point i have all configured properly.

When i'm trying to add ImGui to my setup i failed, a Python script is used to compile C++ code.

import subprocess

file_name = "main"
include_dir = "dependencies/include"
lib_dir = "dependencies/lib"
lib = "-lglew32s -lopengl32 -lgdi32 -lfreeglut"
imguih = "dependencies/include/*.h"
imguicpp = "dependencies/include/*.cpp"
preprocessor = "-DGLEW_STATIC"

def main():
subprocess.call(f"g++ {preprocessor} -c main.cpp -I{include_dir}")
subprocess.call(f"g++ {preprocessor} *.o -o {file_name} -L{lib_dir} {lib} -g {imguih} {imguicpp}")

if __name__ == "__main__":
    main()

I have a public repository with my failed attempt: https://github.com/Jojaror/imGui-OpenGL-setup

The issue arises when the compiler processes the file imgui_impl_glut.cpp and fails to recognize the GL/freeglut.h file. If I remove this implementation and subsequently eliminate its usage from my code (which essentially means only checking the version of imgui), everything functions as expected. Therefore, it seems to me that the problem lies in imgui not being able to locate my freeglut header. However, I am uncertain about how to specify its location.

From my perspective, I have already directed the compiler to the location of my freeglut files. Without imGui, everything functions correctly. All other imGui files operate as anticipated, with the exception of the ImGui implementation file for glut.

dependencies/include/imgui_impl_glut.cpp:44:10: fatal error: GL/freeglut.h: No such file or directory
   44 | #include <GL/freeglut.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.

Any assistance?

0

There are 0 best solutions below