LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1123|回复: 5

gtk配置问题

[复制链接]
发表于 2006-2-21 11:29:20 | 显示全部楼层 |阅读模式
我用gcc -o hello hello.c 'pkg-config --cflags --libs gtk+-2.0'编译,
出错为
gcc: pkg-config --cflags --libs gtk+-2.0: 没有那个文件或目录
hello.c:1:20: error: gtk/gtk.h: 没有那个文件或目录
hello.c: In function 'main':
hello.c:3: error: 'GtkWidget' undeclared (first use in this function)
hello.c:3: error: (Each undeclared identifier is reported only once
hello.c:3: error: for each function it appears in.)
hello.c:3: error: 'window' undeclared (first use in this function)
hello.c:5: error: 'GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)

我的gtk等都装在/usr/lib里,为什么会:gcc: pkg-config --cflags --libs gtk+-2.0: 没有那个文件或目录
发表于 2006-2-21 13:07:50 | 显示全部楼层
编译选项不对
回复 支持 反对

使用道具 举报

发表于 2006-2-21 13:42:02 | 显示全部楼层
没加
#include <gtk/gtk.h>
回复 支持 反对

使用道具 举报

发表于 2006-2-21 14:15:49 | 显示全部楼层
没安装gtk 2.0的开发包。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-2-21 15:36:00 | 显示全部楼层
Post by wcw
我用gcc -o hello hello.c 'pkg-config --cflags --libs gtk+-2.0'编译,
出错为
gcc: pkg-config --cflags --libs gtk+-2.0: 没有那个文件或目录
hello.c:1:20: error: gtk/gtk.h: 没有那个文件或目录
hello.c: In function 'main':
hello.c:3: error: 'GtkWidget' undeclared (first use in this function)
hello.c:3: error: (Each undeclared identifier is reported only once
hello.c:3: error: for each function it appears in.)
hello.c:3: error: 'window' undeclared (first use in this function)
hello.c:5: error: 'GTK_WINDOW_TOPLEVEL' undeclared (first use in this function)

我的gtk等都装在/usr/lib里,为什么会:gcc: pkg-config --cflags --libs gtk+-2.0: 没有那个文件或目录

我知道了,原来是`pkg-config……`,两边的不是单引号,而是esc下的那个点
回复 支持 反对

使用道具 举报

发表于 2006-2-21 16:14:19 | 显示全部楼层
呵呵,一想就是了。用单引号让 gcc 以为那是一个文件。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表