imgui: Can't compile ImGui::GetWindowFont because of Windows.h conflict

The following function declaration in imgui.h

IMGUI_API ImFont*       GetWindowFont();

cannot be compiled if Windows.h was included before imgui.h, because Windows.h defines a macro with the name GetWindowFont.

I suggest renaming it so it doesn’t conflict, for the convenience of Windows users.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 17 (9 by maintainers)

Commits related to this issue

Most upvoted comments

The simplest solution is to include imgui before windows.h or whatever else is including it, or isolate your gui code away from the others and just include your gui class into where you use it. Then in your gui class file you include only imgui. On Sep 20, 2015 6:16 AM, “omar” notifications@github.com wrote:

That wouldn’t work with the C/C++ preprocessor.

— Reply to this email directly or view it on GitHub https://github.com/ocornut/imgui/issues/340#issuecomment-141778134.