pthom / hello_imgui

Hello, Dear ImGui: unleash your creativity in app development and prototyping
https://pthom.github.io/hello_imgui
MIT License
606 stars 91 forks source link

Build failure in MinGW 8.1 #30

Closed BigBIueWhale closed 1 year ago

BigBIueWhale commented 1 year ago

An issue in the file "hello_imgui/internal/backend_impls/backend_window_helper/window_geometry_helper.cpp" Unnecessary include: #include <filesystem> Causes build failure when compiling with MinGW 8.1 That's because MinGW 8.1 has a known bug where including causes a build failure: https://stackoverflow.com/a/56493176/7753444

Also requires adding this line set(HELLOIMGUI_WIN32_EXECUTABLE OFF) and only then include(hello_imgui_add_app) because otherwise the build fails with a linker error:

[build] [ 98%] Linking CXX executable hello_world.exe
[build] G__~1.EXE: error: /SUBSYSTEM:WINDOWS: No such file or directory
[build] G__~1.EXE: error: /ENTRY:mainCRTStartup: No such file or directory

That's because the correct compiler flag for MinGW to compile an executable without a console is: target_link_options(Main PRIVATE -Wl,--subsystem,windows) # The two options are: windows, console

With those two fixes, the build succeeds. I now created a poll request that fixes the issue https://github.com/pthom/hello_imgui/pull/31#issue-1555642552

pthom commented 1 year ago

Many thanks, your PR was merged!