LinuxSir.cn,穿越时空的Linuxsir!

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

使用gtk2.0库需要至少使用哪个版本的gcc?

[复制链接]
发表于 2006-6-3 00:35:15 | 显示全部楼层 |阅读模式
我是这样安装了gtk2.0库:apt-get install libgtk2.0-dev
开发环境是:eclipse+cdt,gcc是debian sarge自带`的 3.3.5 版本;
cdt会自动导入
/usr/local/include
/usr/lib/gcc/lib/i486-linux/3.3.5/include
/usr/include
我安装完tgk2.0库之后,手动导入了:
/usr/include/gtk-2.0
/usr/include/atk-1.0
/usr/include/glib-2.0
/usr/include/pango-1.0

之后编译:
HelloWorld.c
#include <gtk/gtk.h>

编译的时候报了很多错误,这是其中的一小部分:
/usr/include/gtk-2.0/gtk/gtkbox.h:58: error: syntax error before "gint16"
/usr/include/gtk-2.0/gtk/gtkbox.h:58: warning: no semicolon at end of struct or union
/usr/include/gtk-2.0/gtk/gtkbox.h:59: error: syntax error before ':' token
/usr/include/gtk-2.0/gtk/gtkbox.h:70: error: syntax error before "guint16"
/usr/include/gtk-2.0/gtk/gtkbox.h:70: warning: no semicolon at end of struct or union
/usr/include/gtk-2.0/gtk/gtkbox.h:71: error: syntax error before ':' token
/usr/include/gtk-2.0/gtk/gtkbox.h:72: error: syntax error before ':' token
/usr/include/gtk-2.0/gtk/gtkbox.h:73: error: syntax error before ':' token
/usr/include/gtk-2.0/gtk/gtkbox.h:74: error: syntax error before ':' token
/usr/include/gtk-2.0/gtk/gtkcellrenderer.h:58: error: field `parent' has incomplete type
/usr/include/gtk-2.0/gtk/gtkcellrenderer.h:66: error: syntax error before "guint16"
/usr/include/gtk-2.0/gtk/gtkcellrenderer.h:66: warning: no semicolon at end of struct or union
/usr/include/gtk-2.0/gtk/gtkcellrenderer.h:67: warning: type defaults to `int' in declaration of `ypad'
/usr/include/gtk-2.0/gtk/gtkcellrenderer.h:67: warning: data definition has no type or storage class

好象是语法不对,是不是gcc3.3.5以后的版本可以使用更多的语法了,导致
低版本的gcc不能识别语法
发表于 2006-6-3 07:30:40 | 显示全部楼层
  1. [b][size=2]Package libgtk2.0-dev[/size][/b]

  2.     * [color="Blue"]oldstable [/color](devel): Development files for the GTK+ library.
  3.       2.0.2-5woody3: alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc
  4.       2.0.2-5woody2: alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc
  5.     * [color="Blue"]stable [/color](libdevel): Development files for the GTK+ library
  6.       2.6.4-3.1: alpha amd64 arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc
  7.       2.6.4-3: amd64
  8.     * [color="Blue"]testing [/color](libdevel): Development files for the GTK+ library
  9.       2.8.16-1: alpha arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc
  10.     * [color="Blue"]unstable [/color](libdevel): Development files for the GTK+ library
  11.       2.8.17-2: alpha amd64 arm hppa hurd-i386 i386 ia64 kfreebsd-i386 m68k mips mipsel powerpc s390 sparc
复制代码
这是 packages.debian.org 搜索的结果,可能跟 gcc 版本无关

你在用哪个 branch 的 libgtk2.0-dev?版本是什麽?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-3 13:50:23 | 显示全部楼层
下面是我的sourcelist

#deb file:///cdrom/ sarge main

deb ftp://mirrors.geekbone.org/debian/ stable main contrib non-free
deb-src ftp://mirrors.geekbone.org/debian/ stable main contrib non-free

deb http://debian.ustc.edu.cn/debian/ stable main contrib non-free
deb-src http://debian.ustc.edu.cn/debian/ stable main contrib non-free

deb http://debian.cn99.com/debian/ stable main contrib non-free
deb-src http://debian.cn99.com/debian/ stable main contrib non-free

#for mplayer
deb ftp://ftp.nerim.net/debian-marillat/ sarge main

# deb http://security.debian.org/ stable/updates main

我指向的全是stable,所以应该是
* stable (libdevel): Development files for the GTK+ library
      2.6.4-3.1: alpha amd64 arm hppa i386 ia64 m68k mips mipsel powerpc s390 sparc
      2.6.4-3: amd64
回复 支持 反对

使用道具 举报

发表于 2006-6-3 18:21:37 | 显示全部楼层
Stable 的 gtk 对应 stable 的 gcc 不应该有问题,你说手动导入是什麽意思?
我安装完tgk2.0库之后,手动导入了:
/usr/include/gtk-2.0
/usr/include/atk-1.0
/usr/include/glib-2.0
/usr/include/pango-1.0
另,HelloWorld.c 是啥?
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-6-3 20:18:02 | 显示全部楼层
Post by d00m3d
Stable 的 gtk 对应 stable 的 gcc 不应该有问题,你说手动导入是什麽意思?
另,HelloWorld.c 是啥?
cdt是eclipse的一个插件,可以用他来开发C/C++,cdt默认导入库的路径是:
/usr/local/include
/usr/lib/gcc/lib/i486-linux/3.3.5/include
/usr/include
我安装了gtk之后,为了能让gcc在编译HelloWorld.c时能找到库的路径,所以就自己添加了gtk的库的路径;

HelloWorld.c就是一个C文件阿
只有一行测试代码:#include <gtk/gtk.h>

这是图片
http://www.cnoug.org/attachments/month_0606/0ogU_Screenshot.png
回复 支持 反对

使用道具 举报

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

本版积分规则

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