Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

imgui_impl_opengl3 macro redefinitions using GLAD, GLFW, OPENGL #5642

Closed
petrasvestartas opened this issue Sep 4, 2022 · 4 comments
Closed

Comments

@petrasvestartas
Copy link

petrasvestartas commented Sep 4, 2022

Hi,

I have a lot of macros redefined mainly coming from #include "imgui_impl_opengl3.h" and "imgui_impl_opengl3.cpp"
I am using GLAD, GLFW, OPENGL, and recent IMGUI. How can I avoid these redefinitions?

image

After including this #define IMGUI_IMPL_OPENGL_LOADER_CUSTOM
I get 4 unsafe warnings, maybe I am to picky but I would like to resolve those:
image

@PathogenDavid
Copy link
Contributor

For future reference, build issues should be opened as GitHub Discussions.

imgui_impl_opengl3.cpp

Generally speaking, you should not include .cpp files. They should be built separately and then linked, which avoids this issue.

As you've found though, if you're doing a unity build you can define IMGUI_IMPL_OPENGL_LOADER_CUSTOM to avoid the duplicate definitions.

I get 4 unsafe warnings, maybe I am to picky but I would like to resolve those:

Not sure why you're getting those warnings unless you modified imgui_impl_opengl3.cpp, it's supposed to disable them:

#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif

The "secure" variants of those functions are Microsoft-specific. Dear ImGui is cross-platform so we can't use them.

@ocornut
Copy link
Owner

ocornut commented Sep 4, 2022 via email

@PathogenDavid
Copy link
Contributor

Oh right, that'd do it too 😅

@ocornut
Copy link
Owner

ocornut commented Sep 5, 2022

I have added extra comments in the header of this file, hoping it'd help people find the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants