Minimum Requirements for Using Dear ImGui: Complete Setup Guide

Dear ImGui requires only a C++11-compliant compiler, the five core source files, and a matching pair of platform and renderer backends to render an immediate-mode graphical user interface.

Dear ImGui is a portable, immediate-mode GUI library written in C++ that ships as headers and source files without external dependencies. Because the library intentionally avoids providing its own windowing system or graphics API, understanding the minimum requirements for using Dear ImGui involves selecting the correct combination of core library code and backend implementations from the ocornut/imgui repository.

C++11 Compiler Support

The only hard language requirement is a compiler supporting C++11 or newer. According to the source code in imgui.h and the implementation files, the library utilizes modern C++ features including lambdas, nullptr, and std::string.

Compatible compiler versions include:

  • Visual Studio: 2015 or newer
  • GCC: 5 or newer
  • Clang: 3.3 or newer
  • Apple Xcode: 7 or newer

Core Library Files

At minimum, you must include the following files from the repository root in your build:

  • imgui.h — Main API header defining all widgets and data structures
  • imgui.cpp — Core implementation including context management and frame logic
  • imgui_draw.cpp — Drawing utilities and render command generation
  • imgui_widgets.cpp — Standard widget implementations (buttons, sliders, etc.)
  • imgui_tables.cpp — Table and column functionality

Optionally, include imgui_demo.cpp to access the demonstration window and code examples during development.

Backend Architecture

Dear ImGui follows a dual-backend architecture requiring two distinct integration layers.

Platform Backend: Handles OS window creation, input events (keyboard, mouse, gamepad), and window surface management. Located in backends/, examples include:

Renderer Backend: Translates ImGui draw data into GPU commands. Examples include:

You must select exactly one platform backend and one renderer backend compatible with your target environment.

Minimal Implementation Example

The following complete example demonstrates the minimum setup using GLFW (platform) and OpenGL 3 (renderer). This pattern remains consistent across other backend combinations.

// main.cpp
#include "imgui.h"
#include "backends/imgui_impl_glfw.h"
#include "backends/imgui_impl_opengl3.h"
#include <GLFW/glfw3.h>

int main()
{
    // Initialise GLFW and create OpenGL context
    glfwInit();
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
    GLFWwindow* window = glfwCreateWindow(1280, 720, "Dear ImGui Demo", nullptr, nullptr);
    glfwMakeContextCurrent(window);
    glfwSwapInterval(1); // Enable vsync

    // Create ImGui context
    IMGUI_CHECKVERSION();
    ImGui::CreateContext();
    ImGuiIO& io = ImGui::GetIO(); (void)io;

    // Initialise backends
    ImGui_ImplGlfw_InitForOpenGL(window, true);
    ImGui_ImplOpenGL3_Init("#version 130");

    // Main loop
    while (!glfwWindowShouldClose(window))
    {
        glfwPollEvents();

        // Start new frame
        ImGui_ImplOpenGL3_NewFrame();
        ImGui_ImplGlfw_NewFrame();
        ImGui::NewFrame();

        // UI code
        ImGui::Begin("Hello, world!");
        ImGui::Text("This is a minimal ImGui demo.");
        ImGui::End();

        // Rendering
        ImGui::Render();
        int display_w, display_h;
        glfwGetFramebufferSize(window, &display_w, &display_h);
        glViewport(0, 0, display_w, display_h);
        glClearColor(0.45f, 0.55f, 0.60f, 1.00f);
        glClear(GL_COLOR_BUFFER_BIT);
        ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());

        glfwSwapBuffers(window);
    }

    // Cleanup
    ImGui_ImplOpenGL3_Shutdown();
    ImGui_ImplGlfw_Shutdown();
    ImGui::DestroyContext();
    glfwDestroyWindow(window);
    glfwTerminate();
    return 0;
}

Key integration points in this minimal setup:

  1. Context creation: ImGui::CreateContext() allocates the internal state managed in imgui.cpp
  2. Backend initialization: ImGui_ImplGlfw_InitForOpenGL() and ImGui_ImplOpenGL3_Init() establish the platform/renderer bridge
  3. Frame lifecycle: NewFrame() → UI construction → Render() → RenderDrawData() constitutes the immediate-mode workflow
  4. Cleanup: Explicit shutdown calls prevent resource leaks in imgui_impl_opengl3.cpp and imgui_impl_glfw.cpp

Build System Requirements

No specific build system is mandated. You can integrate Dear ImGui using:

  • Makefiles — Direct compilation of .cpp files with include paths set to the repository root
  • CMake — Add the core files and selected backend sources to your target
  • Visual Studio — Include files directly in project properties
  • Meson, Bazel, etc. — Any system capable of compiling C++11 source and linking external libraries

The selected platform backend (e.g., GLFW) requires its corresponding development libraries and runtime DLLs/Dylibs/SOs to be available during compilation and execution.

Summary

Frequently Asked Questions

Does Dear ImGui require a specific graphics API?

No. Dear ImGui generates geometry and draw commands that are API-agnostic. You must provide a renderer backend that translates these commands into your chosen graphics API, such as OpenGL 3 (imgui_impl_opengl3.cpp), DirectX 11 (imgui_impl_dx11.cpp), or Vulkan (imgui_impl_vulkan.cpp). The core library in imgui.cpp contains no GPU-specific code.

Can I use Dear ImGui without C++11?

No. The source code in imgui.h and imgui.cpp requires C++11 features including lambdas, nullptr, and standard library containers. Compilers older than Visual Studio 2015, GCC 5, or Clang 3.3 lack the necessary language support and will fail to compile the library.

Is the demo file (imgui_demo.cpp) required for production builds?

No. imgui_demo.cpp provides the demonstration window and example code useful during development, but it is not required for core functionality. Production applications typically exclude this file to reduce binary size, including only the five core implementation files and the two selected backend files.

How do I choose between GLFW, SDL2, and Win32 backends?

Select the platform backend matching your existing application architecture or target platform. GLFW (imgui_impl_glfw.cpp) and SDL2 (imgui_impl_sdl2.cpp) offer cross-platform windowing, while Win32 (imgui_impl_win32.cpp) provides native Windows integration without external dependencies. The renderer backend selection (OpenGL, DirectX, Vulkan) should match your graphics pipeline capabilities.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →