使用代码块设置gtk的步骤?

时间:2013-05-31 09:14:59

标签: gtk codeblocks

在Windows 7 64bit中 我一直在收到错误 我已经下载了Windows的gtk包,解压缩并运行了一些命令 我试图基于这个艺术 http://forums.codeblocks.org/index.php?topic=16468.0 我坚持在第3步我不知道什么bin?来自哪里? 我也不知道怎么做4a,b 谢谢你的帮助

-------------- Build: Debug in zxc ---------------

Compiling: main.c
In file included from C:\gtk\include\gtk-2.0/gdk/gdk.h:32,
                 from C:\gtk\include\gtk-2.0/gtk/gtk.h:32,
                 from C:\Users\Administrator\Desktop\AlphaBook\zxc\main.c:2:
C:\gtk\include\gtk-2.0/gdk/gdkapplaunchcontext.h:30:21: error: gio/gio.h: No such file or directory
In file included from C:\gtk\include\gtk-2.0/gdk/gdkapplaunchcontext.h:31,
                 from C:\gtk\include\gtk-2.0/gdk/gdk.h:32,
                 from C:\gtk\include\gtk-2.0/gtk/gtk.h:32,
                 from C:\Users\Administrator\Desktop\AlphaBook\zxc\main.c:2:
C:\gtk\include\gtk-2.0/gdk/gdkscreen.h:31:19: error: cairo.h: No such file or directory
In file included from C:\gtk\include\gtk-2.0/gdk/gdkscreen.h:32,
                 from C:\gtk\include\gtk-2.0/gdk/gdkapplaunchcontext.h:31,
                 from C:\gtk\include\gtk-2.0/gdk/gdk.h:32,
                 from C:\gtk\include\gtk-2.0/gtk/gtk.h:32,
                 from C:\Users\Administrator\Desktop\AlphaBook\zxc\main.c:2:
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:36:18: error: glib.h: No such file or directory
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:37:25: error: pango/pango.h: No such file or directory
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:38:25: error: glib-object.h: No such file or directory
In file included from C:\gtk\include\gtk-2.0/gdk/gdkscreen.h:32,
                 from C:\gtk\include\gtk-2.0/gdk/gdkapplaunchcontext.h:31,
                 from C:\gtk\include\gtk-2.0/gdk/gdk.h:32,
                 from C:\gtk\include\gtk-2.0/gtk/gtk.h:32,
                 from C:\Users\Administrator\Desktop\AlphaBook\zxc\main.c:2:
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:68: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'typedef'
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:78: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'GdkWChar'
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:95: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'GdkNativeWindow'
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:184: error: expected ')' before 'data'
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:190: error: expected ')' before 'data'
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:196: error: expected specifier-qualifier-list before 'gint'
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:202: error: expected specifier-qualifier-list before 'gint'
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:210: error: expected specifier-qualifier-list before 'gint'
C:\gtk\include\gtk-2.0/gdk/gdktypes.h:218: error: expected specifier-qualifier-list before 'gint'
In file included from C:\gtk\include\gtk-2.0/gdk/gdkevents.h:34,
                 from C:\gtk\include\gtk-2.0/gdk/gdkdisplay.h:32,
                 from C:\gtk\include\gtk-2.0/gdk/gdkscreen.h:33,
                 from C:\gtk\include\gtk-2.0/gdk/gdkapplaunchcontext.h:31,
                 from C:\gtk\include\gtk-2.0/gdk/gdk.h:32,
                 from C:\gtk\include\gtk-2.0/gtk/gtk.h:32,
                 from C:\Users\Administrator\Desktop\AlphaBook\zxc\main.c:2:
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:37: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'G_BEGIN_DECLS'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:71: error: expected specifier-qualifier-list before 'GObject'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:85: error: expected specifier-qualifier-list before 'GObjectClass'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:89: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_colormap_get_type'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:92: error: expected declaration specifiers or '...' before 'gboolean'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:106: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_colormap_get_system_size'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:112: error: expected declaration specifiers or '...' before 'gint'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:115: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_colormap_alloc_colors'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:121: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_colormap_alloc_color'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:127: error: expected declaration specifiers or '...' before 'gint'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:129: error: expected declaration specifiers or '...' before 'gulong'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:136: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_color_parse'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:138: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_color_hash'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:139: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_color_equal'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:141: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:143: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_color_get_type'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:149: error: expected declaration specifiers or '...' before 'gint'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:150: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_color_white'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:152: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_color_black'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:154: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_color_alloc'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:156: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_color_change'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:162: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_colors_alloc'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:169: error: expected declaration specifiers or '...' before 'gulong'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:170: error: expected declaration specifiers or '...' before 'gint'
C:\gtk\include\gtk-2.0/gdk/gdkcolor.h:171: error: expected declaration specifiers or '...' before 'gulong'
In file included from C:\gtk\include\gtk-2.0/gdk/gdkevents.h:36,
                 from C:\gtk\include\gtk-2.0/gdk/gdkdisplay.h:32,
                 from C:\gtk\include\gtk-2.0/gdk/gdkscreen.h:33,
                 from C:\gtk\include\gtk-2.0/gdk/gdkapplaunchcontext.h:31,
                 from C:\gtk\include\gtk-2.0/gdk/gdk.h:32,
                 from C:\gtk\include\gtk-2.0/gtk/gtk.h:32,
                 from C:\Users\Administrator\Desktop\AlphaBook\zxc\main.c:2:
C:\gtk\include\gtk-2.0/gdk/gdkdnd.h:36: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'G_BEGIN_DECLS'
C:\gtk\include\gtk-2.0/gdk/gdkdnd.h:76: error: expected specifier-qualifier-list before 'GObject'
C:\gtk\include\gtk-2.0/gdk/gdkdnd.h:100: error: expected specifier-qualifier-list before 'GObjectClass'
C:\gtk\include\gtk-2.0/gdk/gdkdnd.h:106: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'gdk_drag_context_get_type'
C:\gtk\include\gtk-2.0/gdk/gdkdnd.h:108: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
C:\gtk\include\gtk-2.0/gdk/gdkdnd.h:111: error: expected '=', ',', ';', 'asm' or '__attribute__' before '*' token
C:\gtk\include\gtk-2.0/gdk/gdkdnd.h:112: error: expected ')' before '*' token
C:\gtk\include\gtk-2.0/gdk/gdkdnd.h:113: error: expected ')' before '*' token
C:\gtk\include\gtk-2.0/gdk/gdkdnd.h:114: error: expected ')' before '*' token
C:\gtk\include\gtk-2.0/gdk/gdkdnd.h:116: error: expected ')' before '*' token
C:\gtk\include\gtk-2.0/gdk/gdkdnd.h:117: error: expected ')' before '*' token
Process terminated with status 1 (1 minutes, 1 seconds)
50 errors, 0 warnings

1 个答案:

答案 0 :(得分:2)

这是我在Code :: blocks中设置GTK的简单解释。

第1步:  从http://www.gtk.org/download/win32.php下载gtk + -bundle_2.24.10-20120208_win32.zip(一体化套装)

步骤2.在c盘或任何其他地方提取它。在我的情况下, C:\ GTK 是我解压缩zip文件的目录。

步骤3.现在打开Code :: Blocks,创建新项目,从项目向导中选择GTK项目。提供项目名称“ GTKsample ”或提供您选择的名称。为解压缩zip文件的GTK位置提供路径 C:\ GTK 。创建gtk项目后,你会看到示例程序然后构建它,构建必须成功。

步骤4.这是最后一步,第3步构建项目必须成功。当您尝试运行项目时,您将收到消息,因为我们没有为运行时库(.dll文件)提供路径,因此缺少.dll文件(运行时库)。为此,转到解压缩zip文件的 C:\ GTK 目录。打开 bin 文件夹,只复制所有 .dll 文件,并将其粘贴到项目目录 GTKsample \ bin \ Debug \ 中,并附带项目可执行文件。在这种方法中,每次创建项目时都必须将所有.dll文件保存为项目可执行文件,即(在project \ bin \ Debug \文件夹中)。如果您不想这样,则将bin文件夹中的所有.dll文件复制并粘贴到 C:\ windows \ system32 目录。 现在运行该项目。您必须已成功运行项目。

您可以按照 site 进行逐步说明,并附上每一步的图片。