简体   繁体   English

gdk/gdk.h:没有这样的文件或目录

[英]gdk/gdk.h: No such file or directory

I am trying to use gui with gkt-2.0 in Linux mint 32bit.我正在尝试在 Linux mint 32bit 中使用带有 gkt-2.0 的 gui。 When I try to compile gui.c I encountered following error message:当我尝试编译 gui.c 时,我遇到了以下错误消息:

#include<gtk-2.0/gtk/gtk.h>

void main(){
}
In file included from gui.c:1:0:
/usr/include/gtk-2.0/gtk/gtk.h:32:10: fatal error: gdk/gdk.h: No such file or directory
 #include <gdk/gdk.h>
          ^~~~~~~~~~~

When the appropriate packages are installed, you can add the needed include search directories with option -I , and the libraries of course -l , eg安装适当的软件包后,您可以使用选项-I添加所需的包含搜索目录,当然还有库-l ,例如

gcc -I/usr/include/gtk-2.0 gui.c -o gui -lgtk-2.0

The source should be changed to源应更改为

#include <gtk/gtk.h>

To avoid hard-coding any paths and names, you could use pkg-config (Compiling GTK Applications on UNIX)为避免硬编码任何路径和名称,您可以使用pkg-config (Compiling GTK Applications on UNIX)

gcc $(pkg-config --cflags gtk+-3.0) gui.c -o gui $(pkg-config --libs gtk+-3.0)

Better yet, use make or some other build tool.更好的是,使用make或其他一些构建工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM