epezent / implot

Immediate Mode Plotting
MIT License
4.64k stars 516 forks source link

Implot demo build error - #define IMGUI_DEFINE_MATH_OPERATORS before including imgui.h #454

Closed kevinfructuoso closed 1 year ago

kevinfructuoso commented 1 year ago

I just started working on a project with Dear Imgui and Implot. I was building a few days ago and everything was building okay.

It seems Dear Imgui just released v1.89.4 yesterday. Perhaps this is a new change but I tried to build the project and ran into this error. I am using ImPlot tag v0.14

In file included from implot/implot_internal.h:39,
                 from implot/implot_demo.cpp:2372:
imgui/imgui_internal.h:101:2: error: #error Please '#define IMGUI_DEFINE_MATH_OPERATORS' _BEFORE_ including imgui.h!
  101 | #error Please '#define IMGUI_DEFINE_MATH_OPERATORS' _BEFORE_ including imgui.h!

For now, I have simply added the #define in implot.h just before the #pragma once #include "imgui.h" and it built without a problem from there.

I see that this #define is in implot_internal.h but none in implot.h, which is required to be included before implot_internal.h.

epezent commented 1 year ago

@kevinfructuoso can you try building against master to see if https://github.com/epezent/implot/commit/33c5a965f55f80057f197257d1d1cdb06523e963 fixes your build issue?

Ch3my commented 1 year ago

Implementing the changes of 33c5a965f55f80057f197257d1d1cdb06523e963 fixes the issue for me.

I'm using Implot v0.14 and just updated ImGUI to 1.89.5

kevinfructuoso commented 1 year ago

Sorry for the delay. I just tested against master as well. Looks like it worked!