Solved Errors trying to use gtk on C

Gtk is a mess with regards to where it spams its header files all over the filesystem.

Luckily there is a good kludge. pkg-config. Just run this:

Code:
# For GTK 2.x
$ pkg-config --cflags gtk+-2.0

# For GTK 3.x
$ pkg-config --cflags gtk+-3.0

You can use backticks ` to call from shell scripts or Makefiles. Or use the execute feature of CMake. i.e:

$ cc `pkg-config --cflags gtk+-2.0` main.c

Once that is in place, when it comes to linking, GTK is just as messy. So again, pkg-config.

$ pkg-config --libs gtk+-2.0
 
Using find / iname gtk.h found /usr/local/include/gtk-3.0/gtk/gtk.h here. Do you have such a file and is it included in your search path for header files?
i have it /usr/local/include/gtk-3.0/gtk/gtk.h:30:10: fatal error: gdk/gdk.h: No such file or directory
but
/usr/local/include/gtk-3.0/gtk/gtk.h:30:10: fatal error: gdk/gdk.h: No such file or directory

I tried all these already nothing works and the pkg-config without any luck
 
First it was about gtk, now gdk? Looks like progress, gtk.h wants to include gdk.h which comes with gtk3 too. Same thing, see if the file is installed and check if it is in your include path.
Yes i had stuck on gdk didn't mention it.
/usr/local/include/gtk-3.0/gtk/gtk.h:30:10: fatal error: gdk/gdk.h: No such file or directory
30 | #include <gdk/gdk.h>
| ^~~~~~~~~~~
 
So you need to include a *lot* of different paths with GTK. This is an example (on OpenBSD but FreeBSD is similar).

$ pkg-config --cflags gtk+-3.0

Results in the following mess:

Code:
-I/usr/local/include/gtk-3.0 -I/usr/local/include/at-spi2-atk/2.0 -I/usr/local/includ
e/at-spi-2.0 -I/usr/X11R6/include -I/usr/local/include/dbus-1.0 -I/usr/local/lib/dbus
-1.0/include -I/usr/local/include -I/usr/local/include/gio-unix-2.0 -I/usr/local/incl
ude/cairo -I/usr/X11R6/include/libdrm -I/usr/local/include/pango-1.0 -I/usr/local/inc
lude/fribidi -I/usr/local/include/harfbuzz -I/usr/local/include/atk-1.0 -I/usr/X11R6/
include/pixman-1 -I/usr/X11R6/include/freetype2 -I/usr/local/include/libpng16 -I/usr/
local/include/gdk-pixbuf-2.0 -pthread -I/usr/local/include/glib-2.0 -I/usr/local/lib/
glib-2.0/include

Every one of those bits beginning with -I need to be added to the include path. You generally don't want to do this manually. Instead pass this pkg-config output directly into the compiler.
 
Seeing the command line for the failed compilation would help. If you are using pkgconf(1) or pkg-config(1), it should just work whether you're using clang or gcc.

If you're using shells/fish, programs like pkg-config have issues because they expect a shell that splits arguments on any form of whitespace, but fish does not do that. See the Command Substitution section of the Fish Tutorial for more information. Fish is the only shell that I've seen with this sort of issue, but there may be other shells with similar behavior, so you might need to adjust the pkg-config command substitution to work with your particular shell.
 
Seeing the command line for the failed compilation would help. If you are using pkgconf(1) or pkg-config(1), it should just work whether you're using clang or gcc.

If you're using shells/fish, programs like pkg-config have issues because they expect a shell that splits arguments on any form of whitespace, but fish does not do that. See the Command Substitution section of the Fish Tutorial for more information. Fish is the only shell that I've seen with this sort of issue, but there may be other shells with similar behavior, so you might need to adjust the pkg-config command substitution to work with your particular shell.
:cool:
1629977320597.png
 
Does that mean the problem is solved?
I have a problem with virtualbox on plasma it gives me a 5k resolution and black desktop and no panel when i switch to 1080p it displays the desktop correctly why it does that ?
Except of that acceleration seems to work very good with blurred transparencies and stuff.

Also if you feel adventurous get an experimental project of mine i will upload it today check it . Don't be harsh i don't have more than two years since i first started learning about freebsd.
Wait for the new upload with codename:Ufo Cult

See the video lol
View: https://www.youtube.com/watch?v=HVcx6GPjjPg&t=4s




Needs to be done
1) I need to make it take up less space ....
2) Need to make a better installer with more options , more fool proof and a graphical application i will create later
3) Need the gpu autoloader/configuration script to support older amd gpus using radeon driver
4) Need a software boutique i will create in gtk or qt creator
 
Back
Top