Skip to content

1.81: docking: error: redundant redeclaration of ‘ImGuiViewport* ImGui::GetMainViewport() #3800

@adamkewley

Description

@adamkewley

Hi,

This isn't a fatal issue (or an issue at all, really) and was easy for me to fix downstream. This only occurs when developers are using custom warning flags and I'm posting it as an issue just so that you're aware.

I copied the 1.81/docking source (239d098) into my tree and compiled it with g++8.3.0 (Debian buster's default). My compilation flags include a custom warning -Wredundant-decls. The full compiler config (CMake) is here:

https://github.com/adamkewley/osmv/blob/5e336f38a35644a37fa64ccddfd752381cd1c187/CMakeLists.txt#L135

Compiling produces this error:

In file included from /home/adam/Desktop/osmv/master/repo/third_party/imgui/backends/imgui_impl_opengl3.h:26,
                 from /home/adam/Desktop/osmv/master/repo/src/application.cpp:20:
/home/adam/Desktop/osmv/master/repo/third_party/imgui/imgui.h:908:33: error: redundant redeclaration of ‘ImGuiViewport* ImGui::GetMainViewport()’ in same scope [-Werror=redundant-decls]
     IMGUI_API ImGuiViewport*    GetMainViewport();                                              // return primary/default viewport. In the future in "no main platform window" mode we will direct this to primary monitor.
                                 ^~~~~~~~~~~~~~~
/home/adam/Desktop/osmv/master/repo/third_party/imgui/imgui.h:823:30: note: previous declaration of ‘ImGuiViewport* ImGui::GetMainViewport()’
     IMGUI_API ImGuiViewport* GetMainViewport();                                                 // return primary/default viewport.
                              ^~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

Which is because imgui.h now contains two declarations of GetMainViewport().

Again, this isn't a big deal. I'm aware that my compilation settings are incredibly anal (all warnings are errors, max warnings, pedantic mode, extra custom flags). This is because I don't trust myself ;)

I'll PR the change separately if you want a one-click fix. However, it's so trivial that I'd understand if you just wanted to do it on your own dev branch and directly push it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions