Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
find_package(wxWidgets REQUIRED COMPONENTS gl net core base)
if (wxWidgets_USE_FILE) # not defined in CONFIG mode
include(${wxWidgets_USE_FILE})
endif ()
CMake and compilation run successfully, but during the linking stage I get the following errors:
/usr/bin/ld: cannot find -lwx_gtk3u_unofficial_gl-3.2: No such file or directory
/usr/bin/ld: cannot find -lwx_baseu_unofficial_net-3.2: No such file or directory
/usr/bin/ld: cannot find -lwx_gtk3u_unofficial_core-3.2: No such file or directory
/usr/bin/ld: cannot find -lwx_baseu_unofficial-3.2: No such file or directory
Why are these libraries missing and where can I get them?
In other words, using the same wx debs as you, I have the libs that your linker can't find.
If you have them too, then you need to tell CLion where to find them. I don't use that IDE so I can't tell you how, but there's a lot of information (more than most people need ) here.
I'm not sure why their versions are 3.3 and there is no "unofficial" part in their names. What may be relevant is that after getting these linker errors, I've tried this method: https://docs.wxwidgets.org/3.2/plat_gtk_install.html. However, the repo I used was for 3.2 version too and after getting no result I "sudo make uninstalled" it.
wx-config --version, by the way, returns "3.3.0" too.
Last edited by Forthro on Tue Jun 06, 2023 5:13 pm, edited 1 time in total.
So you have wx3.3 installed too, but in /usr/local instead of /usr. That's the default location for a self-build.
What happens if you do: sudo update-alternatives --display wx-config
That should show if you have multiple wx installs (though I can't remember if it looks in /usr/local too: I never install self-builds there anyway).
You can also use sudo update-alternatives --config wx-config
to choose a different version.
wx-config - auto mode
link best version is /usr/lib/x86_64-linux-gnu/wx/config/gtk3-unicode-3.2-unofficial
link currently points to /usr/lib/x86_64-linux-gnu/wx/config/gtk3-unicode-3.2-unofficial
link wx-config is /usr/bin/wx-config
/usr/lib/x86_64-linux-gnu/wx/config/base-unicode-3.2-unofficial - priority 327
/usr/lib/x86_64-linux-gnu/wx/config/gtk3-unicode-3.2-unofficial - priority 328
and "sudo update-alternatives --config wx-config" too:
OK. Assuming you don't want to delete the /usr/local/ wx, it looks as if you need, in CLion's linker settings, to set one of the env. variables in the above link to /usr/lib/. Perhaps try LIBRARY_PATH.
Thank you for your help. I've managed to find my mistake and it's very embarrassing. Setting LIBRARY_PATH didn't work. However, I've been statically linking C++ libraries and totally forgot that I had a "-static" linker flag. After removing it, everything started working just fine. I'm so sorry for spending your time on such a stupid mistake and, again, I'm very grateful for your help.