1

在 windows 7 64bit 中我不断收到错误我已经下载了 windows 的 gtk 包,提取它并运行了一些我试图基于这篇文章 http://forums.codeblocks.org/index.php?topic=16468.0的命令 我卡在第 3 步,我不知道是什么垃圾箱?从哪里?我也不知道怎么做 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
4

1 回答 1

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 文件与项目可执行文件一起保存,即(在项目 \bin\Debug\ 文件夹内)。如果您不希望这样做,请将所有 .dll 文件从 bin 文件夹复制并粘贴到C:\windows\system32目录。现在运行项目。您必须已成功运行项目。

您可以按照这个网站一步一步地解释每一步的图像。

于 2013-05-31T15:22:28.523 回答