Skip to content

Warnings when compiling in C #114

@memononen

Description

@memononen

I'm using the bindings directly for a C project, and I'm getting a bunch of warnings due to mixed enums, something like this:

5>dcimgui_internal.h(1030,320): Warning C5287 : operands are different enum types 'ImGuiHoveredFlags_' and '<unnamed-enum-ImGuiHoveredFlags_DelayMask_>'; use an explicit cast to silence this warning
(compiling source file '../../src/imgui_utils.c')

Casting via int does not seem to work in this case, but casting via unsigned works. I think this coult be partially a MSVC issue:
https://developercommunity.microsoft.com/t/warning-C5287:-operands-are-different-e/10877942

Another warning I'm hitting is redefinition of IMGUI_VERSION and IMGUI_VERSION_NUM. This happens when both the dcimgui.h and imgui.h are included in the cpp wrapper files.

4>dcimgui.h(36,9): Warning C4005 : 'IMGUI_VERSION': macro redefinition
(compiling source file '../_deps/dcimgui_external-src/backends/dcimgui_impl_opengl3.cpp')
    C:\Users\memon\code\array_merge\build\_deps\imgui_external-src\imgui.h(32,9):
    see previous definition of 'IMGUI_VERSION'

4>dcimgui.h(37,9): Warning C4005 : 'IMGUI_VERSION_NUM': macro redefinition
(compiling source file '../_deps/dcimgui_external-src/backends/dcimgui_impl_opengl3.cpp')
    C:\Users\memon\code\array_merge\build\_deps\imgui_external-src\imgui.h(33,9):
    see previous definition of 'IMGUI_VERSION_NUM'

The define could be fixed by either #undef or #ifndef, but not sure which one makes sense here.

I try to see if I can get the generation process going and try to make PR for the fixes.

MSBuild version 17.14.23+b0019275e
Microsoft (R) C/C++ Optimizing Compiler Version 19.44.35222 for x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions