Skip to content

Compilation of imgui_impl_dx12.cpp fails with GCC 11 #4594

@yh-sb

Description

@yh-sb

Version/Branch of Dear ImGui:

Version: 1.85 WIP (18417)
Branch: master

Dear ImGui 1.85 WIP (18417)
--------------------------------

sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=201703
define: _WIN32
define: _WIN64
define: __MINGW32__
define: __MINGW64__
define: __GNUC__=11
--------------------------------

io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_opengl3
io.ConfigFlags: 0x00000000
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000000E
 HasMouseCursors
 HasSetMousePos
 RendererHasVtxOffset
--------------------------------

io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,512
io.DisplaySize: 1800.00,1350.00
io.DisplayFramebufferScale: 1.00,1.00
--------------------------------

style.WindowPadding: 18.00,18.00
style.WindowBorderSize: 1.00
style.FramePadding: 9.00,6.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 18.00,9.00
style.ItemInnerSpacing: 9.00,9.00

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_dx12.cpp + imgui_impl_glfw.cpp
Compiler: GCC 11.2
Operating System: Windows 10

My Issue/Question:

I have found that backends\imgui_impl_dx12.cpp compilation fails with GCC 11.2 on Windows 10 with the following log:

In file included from D:\dev\software\x86\c++\projects\opengl\opengl-example\third_party\imgui\backends\imgui_impl_dx12.cpp:41:
D:\dev\software\x86\c++\projects\opengl\opengl-example\third_party\imgui\backends\imgui_impl_dx12.h:25:6: error: use of enum 'DXGI_FORMAT' without previous declaration
   25 | enum DXGI_FORMAT;
      |      ^~~~~~~~~~~
D:\dev\software\x86\c++\projects\opengl\opengl-example\third_party\imgui\backends\imgui_impl_dx12.h:36:93: error: 'DXGI_FORMAT' has not been declared
   36 | IMGUI_IMPL_API bool     ImGui_ImplDX12_Init(ID3D12Device* device, int num_frames_in_flight, DXGI_FORMAT rtv_format, ID3D12DescriptorHeap* cbv_srv_heap,
      |                                                                                             ^~~~~~~~~~~
D:\dev\software\x86\c++\projects\opengl\opengl-example\third_party\imgui\backends\imgui_impl_dx12.cpp: In function 'bool ImGui_ImplDX12_CreateDeviceObjects()':
D:\dev\software\x86\c++\projects\opengl\opengl-example\third_party\imgui\backends\imgui_impl_dx12.cpp:517:9: error: 'PFN_D3D12_SERIALIZE_ROOT_SIGNATURE' was not declared in this scope; did you mean 'PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE'?
  517 |         PFN_D3D12_SERIALIZE_ROOT_SIGNATURE D3D12SerializeRootSignatureFn = (PFN_D3D12_SERIALIZE_ROOT_SIGNATURE)::GetProcAddress(d3d12_dll, "D3D12SerializeRootSignature");
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |         PFN_D3D12_SERIALIZE_VERSIONED_ROOT_SIGNATURE
D:\dev\software\x86\c++\projects\opengl\opengl-example\third_party\imgui\backends\imgui_impl_dx12.cpp:518:13: error: 'D3D12SerializeRootSignatureFn' was not declared in this scope; did you mean 'D3D12SerializeRootSignature'?
  518 |         if (D3D12SerializeRootSignatureFn == NULL)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |             D3D12SerializeRootSignature
D:\dev\software\x86\c++\projects\opengl\opengl-example\third_party\imgui\backends\imgui_impl_dx12.cpp:522:13: error: 'D3D12SerializeRootSignatureFn' was not declared in this scope; did you mean 'D3D12SerializeRootSignature'?
  522 |         if (D3D12SerializeRootSignatureFn(&desc, D3D_ROOT_SIGNATURE_VERSION_1, &blob, NULL) != S_OK)
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ImGui already has the following hack in backends\imgui_impl_dx12.h:20 for MSVC:

#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable: 4471) // a forward declaration of an unscoped enumeration must have an underlying type
#endif

It would be great to add similar for GCC.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions