imgui-rs
imgui-rs copied to clipboard
Unresolved symbol with dynamic linking (dylib crate-type)
The complete error:
error LNK2019: unresolved external symbol igTextUnformatted referenced in function_ZN5imgui6widget4text27_$LT$impl$u20$imgui..Ui$GT$4text17h2046f112a25bb173E
To Reproduce
Window::new(im_str!("Hello world"))
.build(ui, ||
{
ui.text("Hello");
});
Expected behavior It should compile and work as intended.
Please describe your environment
- imgui-rs version 0.70
- Windows 10 20H2
Other information
It seems like the library is not linking with cimgui correctly. This only happens if a library is a dylib, but both the executable and library depend on imgui-rs.
Also, are there any plans to switch to the docking branch?
HMM. I have absolutely no idea! Can you tell us more about your dylib?
Also the docking branch is a larger conversation, but please comment on https://github.com/imgui-rs/imgui-rs/issues/435 to help us get in a state where we can have multiple branches
I have a dylib crate that depends on imgui-rs, and reexports it for users. It handles all the backend stuff. When I link it with an executable, and access the reexported functions, the cimgui functions don't link. However, even if I link the executable crate directly with imgui-rs, the undefined symbols still don't go away.
I think this happens with Linux+gcc+ld also
We have a similar sounding setup - basically an application composed of various crates, multiple of which use imgui
I tried making one of the crates by a dylib (to see if it has much impact on development build times, by reducing the amount of things to be statically linked into the main application),
[lib]
crate-type = ["dylib"]
but this results in a screen full of errors along the line of undefined reference to 'igBeginPopup'
I'll try and put together a complete reproduction-example for this, but I think it should just be:
crate_utilwhich uses imgui-rs, and setscrate-type = ["dylib"]crate_mainwhich uses imgui-rs andcrate_util