最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

gtk4 - getting an error related to virtual:world while compiling a gtk application - Stack Overflow

programmeradmin5浏览0评论

I'm learning GTK, and I'm trying to get its hello world example program compile on my ubuntu 24.04 system, but I got this following message:

> gcc $(pkg-config --cflags gtk4) -o hello-world-gtk hello-world-gtk.c $(pkg-config --libs gtk4)

Package gtk4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk4.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk4', required by 'virtual:world', not found
Package gtk4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk4.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk4', required by 'virtual:world', not found
hello-world-gtk.c:1:10: fatal error: gtk/gtk.h: No such file or directory
    1 | #include <gtk/gtk.h>
      |          ^~~~~~~~~~~
compilation terminated.

I believe I have installed gtk packages because I ran this installation command and got the following message:

> sudo apt install libgtk-4-1

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libgtk-4-1 is already the newest version (4.14.2+ds-1ubuntu1).
libgtk-4-1 set to manually installed.
The following packages were automatically installed and are no longer required:
  linux-headers-6.8.0-50 linux-headers-6.8.0-50-generic
  linux-image-6.8.0-50-generic linux-modules-6.8.0-50-generic
  linux-modules-extra-6.8.0-50-generic linux-tools-6.8.0-50
  linux-tools-6.8.0-50-generic python3-netifaces
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 127 not upgraded.

What is wrong here?

I'm learning GTK, and I'm trying to get its hello world example program compile on my ubuntu 24.04 system, but I got this following message:

> gcc $(pkg-config --cflags gtk4) -o hello-world-gtk hello-world-gtk.c $(pkg-config --libs gtk4)

Package gtk4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk4.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk4', required by 'virtual:world', not found
Package gtk4 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk4.pc'
to the PKG_CONFIG_PATH environment variable
Package 'gtk4', required by 'virtual:world', not found
hello-world-gtk.c:1:10: fatal error: gtk/gtk.h: No such file or directory
    1 | #include <gtk/gtk.h>
      |          ^~~~~~~~~~~
compilation terminated.

I believe I have installed gtk packages because I ran this installation command and got the following message:

> sudo apt install libgtk-4-1

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libgtk-4-1 is already the newest version (4.14.2+ds-1ubuntu1).
libgtk-4-1 set to manually installed.
The following packages were automatically installed and are no longer required:
  linux-headers-6.8.0-50 linux-headers-6.8.0-50-generic
  linux-image-6.8.0-50-generic linux-modules-6.8.0-50-generic
  linux-modules-extra-6.8.0-50-generic linux-tools-6.8.0-50
  linux-tools-6.8.0-50-generic python3-netifaces
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 127 not upgraded.

What is wrong here?

Share Improve this question asked 16 hours ago CinverseCinverse 112 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Ubuntu splits development files into separate packages, like libgtk-4-1 has a libgtk-4-dev.

You’ll likely need more dev packages along the way.

发布评论

评论列表(0)

  1. 暂无评论