-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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-sfml] include failure #21530
Comments
Thanks for your issue, I will test this issue locally. |
Seeing the exact same missing symbols on Windows 11 with the Visual Studio 2022 (v143) toolset. imgui-sfml v2.4 and imgui v1.85 are installed via vcpkg. The only minor difference between the code above and mine is that I'm including imgui.h and imgui-SFML.h before I include SFML/Graphics.hpp. |
This issue can be reproduced and I need to check the symbol declarations. |
The reason why these symbols are not found is because the definitions of #ifndef ImTextureID
typedef void* ImTextureID; // Default: store a pointer or an integer fitting in a pointer (most renderer backends are ok with that)
#endif However, in imgui-sfml, it's redefined with #define ImTextureID unsigned int Therefore, the symbol that imgui-sfml expects to find changes from Since imgui officially still does not accept cmake buildsystem, the value of
|
The real problem is that imgui officially stated that imgui should only be used as source files, while imgui is built as a library in vcpkg, which makes it impossible for us to change the value of If the upstream approve PR ocornut/imgui#1713, this issue can be easily resolved. Please note this issue also exists with another variable |
I am not sure I understand how this would solve anything. Build files on the vcpkg repo would be equivalent to build files on imgui repo. It's a matter of whether some compile-time setting can be exposed to the end-user while benefiting from the service of a package manager. Btw, in the case of SFML-imgui, that particular requirement that it wants (There's still a more general issue allowing to expose any compile-time parameter in a package manager, which I presume isn't easy to solve, but at least this one concrete report can easily be closed). |
Addendum:
Yes and no. That comment you relates to the DX12 backend, because the DX12 backend requires ImTextureID to be 64-bits to compile, which would be lead to the same problem as reported here with the SFML backend. But in the case of the SFML backend there's an obvious fix available. (Tangential, there was an unconclusive thread about trying to make Dear ImGui default |
That's because we can provide configure files to the users to easily use imgui, and it can follow the "compile-time redefinition" required in imgui.
I'm not sure whether the SFML-imgui upstream can accept this: just delete the re-defintion code or add conversion code. |
Thanks @ocornut, that makes a lot of sense and agreed that the best option would be for imgui-sfml to not need the compile time parameter at all. @JackBoosY can you do some investigation into how difficult it would be to patch out this macro in the build of imgui-sfml? |
I think it's pretty much only reverting this: |
I have just the same linker error. I tried to run my programm using some previous versions of imgui / imgui-sfml (1.80 for imgui and 2.3 for imgui-sfml), but it also didn't work. My enviroment:
|
You can build with [edited out a block as I don't want to get into another debate about why solving the problem of building backends with cmake is too difficult] |
I think that the simplest way to solve this would be to just remove this line from the I don't really care if |
I will fix this issue today. |
Please ping me or create PR if it works okay for everyone and I'll merge it upstream |
@eliasdaler
Windows:
OSX:
I didn't see any warnings related to my changes. And I will open a PR to imgui-sfml later. |
See microsoft/vcpkg#21530 for more details vcpkg's ImGui is compiled with ImTextureID defined as void* and compiling ImGui-SFML with ImTextureID defined as something else breaks linking with pre-built ImGui.
Small release to fix a broken vcpkg package (see microsoft/vcpkg#21530) * Remove type alias for ImTextureID (#186) (thanks, @JackBoosY)
Fixed upstream. You can now upgrade ImGui-SFML to 2.5 and remove the patch in vcpkg's build recipe |
Small release to fix broken vcpkg package (see microsoft/vcpkg#21530) * Remove type alias for ImTextureID (SFML#186) (thanks, @JackBoosY)
Host Environment
To Reproduce
./vcpkg install imgui-sfml
Small snippet to reproduce the linker error.
(Also, manifest mode projects give the same errors.)
Failure logs
Additional context
v2.3 port worked fine, but as soon as I updated vcpkg to use the v2.4 port, this error pops up.
Probably something is broken in the v2.4 port update(#21460)?
The text was updated successfully, but these errors were encountered: