I am building an opengl project with gcc, getting this error
[build] /usr/bin/ld: /usr/local/lib/libwx_gtk3u_gl-3.2.a(gllib_gtk_glcanvas.o): неопределённая ссылка на символ «gtk_widget_get_allocation»
[build] //usr/lib/x86_64-linux-gnu/libgtk-3.so.0: error adding symbols: DSO missing from command line
[build] collect2: ошибка: выполнение ld завершилось с кодом возврата 1
What can be the problem?
Assistant
The error you're encountering is related to missing linkage of required libraries during the linking stage of your build process. Specifically, the linker (ld) is complaining about a missing symbol gtk_widget_get_allocation, which is part of the GTK+ 3 library.
The critical part of the error message is:
DSO missing from command line
This usually means that the linker needs certain libraries that are not being explicitly specified in the command.
In your case, it looks like you are using wxWidgets with OpenGL, which has a dependency on GTK+ 3 for the graphical user interface components. You need to ensure that the GTK+ 3 libraries are included in your linking command.
To resolve this, you can add the necessary GTK+ 3 libraries to your linker command. GTK+ 3 can be added using the pkg-config utility to get the correct flags. Here’s how you can do it:
Ensure you have pkg-config and GTK+ 3 development files installed:
On Ubuntu or Debian, you can install the GTK+ 3 development files using:
sudo apt-get install libgtk-3-dev
Modify your gcc linking command to include the GTK+ 3 flags provided by pkg-config.