1.首先下载GTK-Runtime-Environment(http://prdownloads.sourceforge.net/gtk-win/GTK-Runtime-Environment-2.2.4-3.exe),安装到D:/Program/GTK2/Runtime目录下。
2.然后下载GTK-Development-Environment(http://prdownloads.sourceforge.net/gtk-win/GTK-Development-Environment-2.2.4-3.exe),安装到D:/Program/GTK2/DevEnv目录下。
3.再下载DevCPP(http://61.163.92.167:82/down/WY_DEVCPP_5B0905.zip),安装到D:/Program/DEV-CPP目录下。
4.右键 “我的电脑”- “属性”- “环境变量”- “系统变量”- 选中“Path” -“编辑”- 在前边加上“D:/Program/GTK2/Runtime/bin;D:/Program/GTK2/Runtime/lib;“
5.打开DevCPP,在“工具->编译选项->目录->库”,加入D:/Program/GTK2/DevEnv/lib。
6.“工程->工程属性->参数” 或 “工具->编译选项”中的链接器框里面填入:-lgtk-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangowin32-1.0 -lgdi32 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl -liconv ,并选中。
7.工具->编译选项加上 -mms-bitfields,并选中。
8. “工具->编译选项->目录->C包含文件”加上:
D:/Program/GTK2/DevEnv/include/atk-1.0
D:/Program/GTK2/DevEnv/include/glib-2.0
D:/Program/GTK2/DevEnv/include/gtk-2.0
D:/Program/GTK2/DevEnv/include/pango-1.0
D:/Program/GTK2/DevEnv/lib/gtk-2.0/include
D:/Program/GTK2/DevEnv/lib/glib-2.0/include
9.在DevCPP中新建一个工程,在main.c中:
运行便可以看到一个简单的窗口了。