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

Add explicit cast to convert void* to ImTextureID to fix a Clang C++ compile time error. #1137

Closed
wants to merge 1 commit into from

Conversation

someposer
Copy link

Fixes the following compiler error when using Sokol headers in a C++ project.

In file included from src/application.cpp:12:
libs/sokol/util/sokol_imgui.h:2434:24: error: incompatible pointer to integer conversion assigning to 'ImTextureID' (aka 'unsigned long long') from 'void *'
 2434 |     io->Fonts->TexID = simgui_imtextureid(_simgui.default_font);
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

This fix is similar to #1134 however, it passes the tests.

@floooh
Copy link
Owner

floooh commented Oct 22, 2024

Thanks! The reason why #1134 currently doesn't build is because this dependency is still pinned to ImGui 1.91.1: https://github.com/fips-libs/fips-cimgui

Did you test your fix with the latest Dear ImGui version? I'm surprised that only this one cast is needed.

PS: ah ok, #1134 fixes the public API, which tbh is the cleaner solution :) I will look into both PRs later this week, but I will probably merge #1134 and close this PR, apologies in advance :)

@floooh
Copy link
Owner

floooh commented Oct 22, 2024

Closing in favor of #1134 (which I just merged), nonetheless, many thanks for submitting the PR :)

@floooh floooh closed this Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants