jvcleave / ofxImGui

Use ImGui in openFrameworks
296 stars 124 forks source link

Example demo from Master branch will not build on Windows 11 and oF 0.12.0 #128

Open PeteHaughie opened 1 month ago

PeteHaughie commented 1 month ago

MSYS2 with MINGW64 on fresh install Windows 11

Builds as expected on Intel Mac

Have also tried the latest release which errored the same on Windows 11 but did not build on Mac.

Appears to be an issue with ofxImGui/src/imconfig.h

$ make Debug
Compiling OF library for Debug
make -j2 -C /c/openFrameworks/libs/openFrameworksCompiled/project/ Debug PLATFORM_OS=MINGW64_NT-10.0-22631 ABIS_TO_COMPILE_DEBUG=""
make[1]: Entering directory '/c/openFrameworks/libs/openFrameworksCompiled/project'
💾 CXX = /mingw64/bin/g++
💾 CC = /mingw64/bin/gcc
💾 CXX = /mingw64/bin/g++
💾 CC = /mingw64/bin/gcc
💾 CXX = /mingw64/bin/g++
💾 CC = /mingw64/bin/gcc
Done!
make[1]: Leaving directory '/c/openFrameworks/libs/openFrameworksCompiled/project'

Compiling example-demo for Debug
make[1]: Entering directory '/c/openFrameworks/addons/ofxImGui/example-demo'
Compiling Resource /c/openFrameworks/libs/openFrameworksCompiled/project/msys2/icon-debug.ico
Compiling src/main.cpp
/mingw64/bin/g++ -c -g3  -DDEBUG -std=gnu++17 -DUNICODE -D_UNICODE -Wall -fexceptions -DOF_VIDEO_PLAYER_DIRECTSHOW -DOF_USING_MPG123  -IC:/msys64/mingw64/include/cairo -IC:/msys64/mingw64/include/pixman-1 -IC:/msys64/mingw64/include/freetype2 -IC:/msys64/mingw64/include/libpng16 -IC:/msys64/mingw64/include/harfbuzz -IC:/msys64/mingw64/include/glib-2.0 -IC:/msys64/mingw64/lib/glib-2.0/include -IC:/msys64/mingw64/include/AL -IC:/msys64/mingw64/include/rtaudio -IC:/msys64/mingw64/include/opus -I/c/openFrameworks/libs/kiss/include -I/c/openFrameworks/libs/tess2/include -I/c/openFrameworks/libs/videoInput/include -I/c/openFrameworks/libs/openFrameworks -I/c/openFrameworks/libs/openFrameworks/3d -I/c/openFrameworks/libs/openFrameworks/app -I/c/openFrameworks/libs/openFrameworks/communication -I/c/openFrameworks/libs/openFrameworks/events -I/c/openFrameworks/libs/openFrameworks/gl -I/c/openFrameworks/libs/openFrameworks/graphics -I/c/openFrameworks/libs/openFrameworks/math -I/c/openFrameworks/libs/openFrameworks/sound -I/c/openFrameworks/libs/openFrameworks/types -I/c/openFrameworks/libs/openFrameworks/utils -I/c/openFrameworks/libs/openFrameworks/video -I./src -I/c/openFrameworks/addons/ofxImGui/src -I/c/openFrameworks/addons/ofxImGui/libs -I/c/openFrameworks/addons/ofxImGui/libs/imgui -I/c/openFrameworks/addons/ofxImGui/libs/imgui/src -MMD -MP -MF obj/msys2/Debug/src/main.d -MT obj/msys2/Debug/src/main.o -o obj/msys2/Debug/src/main.o -c src/main.cpp
Compiling src/MyTheme.cpp
/mingw64/bin/g++ -c -g3  -DDEBUG -std=gnu++17 -DUNICODE -D_UNICODE -Wall -fexceptions -DOF_VIDEO_PLAYER_DIRECTSHOW -DOF_USING_MPG123  -IC:/msys64/mingw64/include/cairo -IC:/msys64/mingw64/include/pixman-1 -IC:/msys64/mingw64/include/freetype2 -IC:/msys64/mingw64/include/libpng16 -IC:/msys64/mingw64/include/harfbuzz -IC:/msys64/mingw64/include/glib-2.0 -IC:/msys64/mingw64/lib/glib-2.0/include -IC:/msys64/mingw64/include/AL -IC:/msys64/mingw64/include/rtaudio -IC:/msys64/mingw64/include/opus -I/c/openFrameworks/libs/kiss/include -I/c/openFrameworks/libs/tess2/include -I/c/openFrameworks/libs/videoInput/include -I/c/openFrameworks/libs/openFrameworks -I/c/openFrameworks/libs/openFrameworks/3d -I/c/openFrameworks/libs/openFrameworks/app -I/c/openFrameworks/libs/openFrameworks/communication -I/c/openFrameworks/libs/openFrameworks/events -I/c/openFrameworks/libs/openFrameworks/gl -I/c/openFrameworks/libs/openFrameworks/graphics -I/c/openFrameworks/libs/openFrameworks/math -I/c/openFrameworks/libs/openFrameworks/sound -I/c/openFrameworks/libs/openFrameworks/types -I/c/openFrameworks/libs/openFrameworks/utils -I/c/openFrameworks/libs/openFrameworks/video -I./src -I/c/openFrameworks/addons/ofxImGui/src -I/c/openFrameworks/addons/ofxImGui/libs -I/c/openFrameworks/addons/ofxImGui/libs/imgui -I/c/openFrameworks/addons/ofxImGui/libs/imgui/src -MMD -MP -MF obj/msys2/Debug/src/MyTheme.d -MT obj/msys2/Debug/src/MyTheme.o -o obj/msys2/Debug/src/MyTheme.o -c src/MyTheme.cpp
In file included from C:/openFrameworks/addons/ofxImGui/libs/imgui/src/imgui.h:45,
                 from C:/openFrameworks/addons/ofxImGui/src/BaseTheme.h:4,
                 from src/MyTheme.h:3,
                 from src/MyTheme.cpp:1:
C:/openFrameworks/addons/ofxImGui/src/imconfig.h:103:19: error: 'ofIndexType' was not declared in this scope
  103 | #define ImDrawIdx ofIndexType
      |                   ^~~~~~~~~~~
C:/openFrameworks/addons/ofxImGui/libs/imgui/src/imgui.h:1863:14: note: in expansion of macro 'ImDrawIdx'
 1863 |     ImVector<ImDrawIdx>         _IdxBuffer;
      |              ^~~~~~~~~
C:/openFrameworks/addons/ofxImGui/libs/imgui/src/imgui.h:1863:23: error: template argument 1 is invalid
 1863 |     ImVector<ImDrawIdx>         _IdxBuffer;
      |                       ^
C:/openFrameworks/addons/ofxImGui/src/imconfig.h:103:19: error: 'ofIndexType' was not declared in this scope
  103 | #define ImDrawIdx ofIndexType
      |                   ^~~~~~~~~~~
C:/openFrameworks/addons/ofxImGui/libs/imgui/src/imgui.h:1917:14: note: in expansion of macro 'ImDrawIdx'
 1917 |     ImVector<ImDrawIdx>     IdxBuffer;          // Index buffer. Each command consume ImDrawCmd::ElemCount of those
      |              ^~~~~~~~~
C:/openFrameworks/addons/ofxImGui/libs/imgui/src/imgui.h:1917:23: error: template argument 1 is invalid
 1917 |     ImVector<ImDrawIdx>     IdxBuffer;          // Index buffer. Each command consume ImDrawCmd::ElemCount of those
      |                       ^
C:/openFrameworks/addons/ofxImGui/src/imconfig.h:103:19: error: 'ofIndexType' does not name a type
  103 | #define ImDrawIdx ofIndexType
      |                   ^~~~~~~~~~~
C:/openFrameworks/addons/ofxImGui/libs/imgui/src/imgui.h:1927:5: note: in expansion of macro 'ImDrawIdx'
 1927 |     ImDrawIdx*              _IdxWritePtr;       // [Internal] point within IdxBuffer.Data after each add command (to avoid using the ImVector<> operators too much)
      |     ^~~~~~~~~
C:/openFrameworks/addons/ofxImGui/src/imconfig.h:103:19: error: 'ofIndexType' has not been declared
  103 | #define ImDrawIdx ofIndexType
      |                   ^~~~~~~~~~~
C:/openFrameworks/addons/ofxImGui/libs/imgui/src/imgui.h:2011:34: note: in expansion of macro 'ImDrawIdx'
 2011 |     inline    void  PrimWriteIdx(ImDrawIdx idx)                                 { *_IdxWritePtr = idx; _IdxWritePtr++; }
      |                                  ^~~~~~~~~
C:/openFrameworks/addons/ofxImGui/libs/imgui/src/imgui.h: In member function 'void ImDrawList::PrimWriteIdx(int)':
C:/openFrameworks/addons/ofxImGui/libs/imgui/src/imgui.h:2011:84: error: '_IdxWritePtr' was not declared in this scope; did you mean '_VtxWritePtr'?
 2011 |     inline    void  PrimWriteIdx(ImDrawIdx idx)                                 { *_IdxWritePtr = idx; _IdxWritePtr++; }
      |                                                                                    ^~~~~~~~~~~~
      |                                                                                    _VtxWritePtr
C:/openFrameworks/addons/ofxImGui/libs/imgui/src/imgui.h: In member function 'void ImDrawList::PrimVtx(const ImVec2&, const ImVec2&, ImU32)':
C:/openFrameworks/addons/ofxImGui/src/imconfig.h:103:19: error: 'ofIndexType' was not declared in this scope
  103 | #define ImDrawIdx ofIndexType
      |                   ^~~~~~~~~~~
C:/openFrameworks/addons/ofxImGui/libs/imgui/src/imgui.h:2012:97: note: in expansion of macro 'ImDrawIdx'
 2012 |     inline    void  PrimVtx(const ImVec2& pos, const ImVec2& uv, ImU32 col)     { PrimWriteIdx((ImDrawIdx)_VtxCurrentIdx); PrimWriteVtx(pos, uv, col); }
      |                                                                                                 ^~~~~~~~~
make[1]: *** [/c/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:219: obj/msys2/Debug/src/MyTheme.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from C:/openFrameworks/addons/ofxImGui/src/ofxImGui.h:5,
                 from src/ofApp.h:4,
                 from src/main.cpp:2:
C:/openFrameworks/addons/ofxImGui/src/Helpers.h:131:20: warning: 'void* GetImTextureID(GLuint)' defined but not used [-Wunused-function]
  131 | static ImTextureID GetImTextureID(GLuint glID)
      |                    ^~~~~~~~~~~~~~
C:/openFrameworks/addons/ofxImGui/src/Helpers.h:125:20: warning: 'void* GetImTextureID(ofBaseHasTexture&)' defined but not used [-Wunused-function]
  125 | static ImTextureID GetImTextureID(ofBaseHasTexture& hasTexture)
      |                    ^~~~~~~~~~~~~~
make[1]: Leaving directory '/c/openFrameworks/addons/ofxImGui/example-demo'
make: *** [/c/openFrameworks/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:145: Debug] Error 2
PeteHaughie commented 1 month ago

Develop branch builds ~with no issues~.

Both Mac and Windows develop branch build (after some type casting) but neither show the left-hand box. The console does give a potential clue that I am not clever enough to understand what to do with:

[notice ] EngineGLFW::setup(): Replaced the openFrameworks' GLFW event listeners by the imgui_impl_glfw ones. You will not have multi-window nor multi-context support. This can be enabled by defining OFXIMGUI_GLFW_FIX_MULTICONTEXT_PRIMARY_VP=1.

Daandelange commented 1 month ago

Hi, Indeed, the release and master-branch are quite outdated and we've been using the develop branch for quite some years. If you needed some type casts, could you submit a PR with the required changes please ?
[edit: oh sorry you already did! :) ]

As to the message, you can ignore it if you have no clue : it's for some newly introduced imgui features, which require a different way of being interfaced with OF. You can read more in develop/readme.md