LinuxSir.cn,穿越时空的Linuxsir!

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

用 Dev-Cpp 开发 gtkmm2 程序

[复制链接]
发表于 2004-3-19 22:36:21 | 显示全部楼层 |阅读模式
用 Dev-Cpp 开发 gtkmm2 程序

一. 下载:
        1. Dev-Cpp4.9.8.0
        http://www.c-view.org/soft/devcpp/downloads/devcpp4980.exe

        2.GTK-Runtime-Environment-2.2.4
        http://keihanna.dl.sourceforge.n ... vironment-2.2.4.exe

        3.GTK-Development-Environment-2.2.4
        http://keihanna.dl.sourceforge.n ... vironment-2.2.4.exe

        4.gtkmm-2.2.8.1
        http://www.pcpm.ucl.ac.be/~gusti ... s/gtkmm-2.2.8.1.exe

        5.gtkmm-runtime-2.2.8.1
        http://www.pcpm.ucl.ac.be/~gusti ... runtime-2.2.8.1.exe

二. 安装
        按顺序先安装这三个文件:
        1. 将 Dev-Cpp4980 安装到 C:\DevCpp(可以自己设, 但必须与下面统一) 目录下
        2. 安装 GTK-Runtime-Environment-2.2.4 到它的缺省目录
        3. 安装 gtkmm-runtime-2.2.8.1 到它的缺省目录

        下面两个程序按顺序安装到你的 C:\DevCpp 目录下, 这将把 include 目录和 lib 目录解压到 DevCpp 目录下, 方便以后的路径设置.
        安装在出现目录提示时, 输入 C:\DevCpp 就行了.
        GTK-Development-Environment-2.2.4
        gtkmm-2.2.8.1

三. 设置
        1. 将 C:\DevCpp 添加到你的环境变量
        打开你的 控制面板->系统->高级->环境变量->系统变量, 双击 Path 项, 弹出一个编辑框, 在末尾加上 ;C:\DevCpp\bin
        注: 也可以在 Autoexec.bat 文件时添加该环境变量.

        2. 在 cmd 窗口下, 输入
        pkg-config --libs --cflags gtkmm-2.0 > pkg-config.txt

        得到一个 pkg-config.txt 文件, 内容是很长的一行. 可以把它编辑成下面这两行:
        -IC:/DevCpp/include/gtkmm-2.0 -IC:/DevCpp/lib/gtkmm-2.0/include -IC:/DevCpp/include/gtk-2.0 -IC:/DevCpp/lib/sigc++-1.2/include -IC:/DevCpp/include/sigc++-1.2 -IC:/DevCpp/include/glib-2.0 -IC:/DevCpp/lib/glib-2.0/include -IC:/DevCpp/lib/gtk-2.0/include -IC:/DevCpp/include/pango-1.0 -IC:/DevCpp/include/atk-1.0  

        -LC:/DevCpp/lib -lgtkmm-2.0 -lgdkmm-2.0 -latkmm-1.0 -lgtk-win32-2.0 -lpangomm-1.0 -lglibmm-2.0 -lsigc-1.2 -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  

四. 测试例子
        1. 新建一个 Dev-Cpp 的 Empty Project
        2. 在工程里新建一个单元 main.cc

                #include <gtkmm.h>

                int main(int argc, char *argv[])
                {
                            Gtk::Main kit(argc, argv);

                            Gtk::Window window;

                            Gtk::Main::run(window);
   
                            return 0;
                }

        3. 打开 工程->工程属性->普通, 选择 Win32图形界面程序.
           打开 工程->工程属性->参数, 在 C++编译器里把 pkg-config.txt 的第一行贴进去, 在连接器一栏把第二行贴进去.

        4. 编译运行, 应该会出现一个简单的窗口.

Congratulations!搞掂! :-)
发表于 2004-4-1 12:25:07 | 显示全部楼层
谢谢!
发表于 2004-4-1 16:13:08 | 显示全部楼层
补一句,加一个环境变量C:\Program Files\Common Files\GTK\2.0\bin
默认的是加C:\Program Files\Common Files\GTK\2.0\lib
发表于 2004-4-1 16:49:35 | 显示全部楼层
唉。。不能访问sourceforge.net,国内有下的吗?
发表于 2004-4-2 21:40:15 | 显示全部楼层
我试了一下
sourceforge 这些天好像又被封了
前些日子还好好的列
等几天吧
发表于 2005-12-9 11:31:07 | 显示全部楼层
我安装了最新2.4版本的gtkmm.按照上面的说明装了。INCLUDE目录也加入了。为什么编译就出下面的错误呢?
编译器: Default compiler
执行  g++.exe...
g++.exe "D:\Dev-Cpp\我\test.cpp" -o "D:\Dev-Cpp\我\test.exe"    -I"D:\Dev-Cpp\INCLUDE"  -I"D:\Dev-Cpp\INCLUDE\GTK-2.0"  -I"D:\Dev-Cpp\INCLUDE\GLIB-2.0"  -I"D:\Dev-Cpp\include\gtkmm-2.4"  -I"D:\Dev-Cpp\INCLUDE\PANGO-1.0"  -I"D:\Dev-Cpp\INCLUDE\CAIRO"  -I"D:\Dev-Cpp\INCLUDE\ATK-1.0"  -I"D:\Dev-Cpp\INCLUDE\GTKGLEXT-1.0"  -I"D:\Dev-Cpp\LIB\GTK-2.0\INCLUDE"  -I"D:\Dev-Cpp\LIB\GLIB-2.0\INCLUDE"  -I"D:\Dev-Cpp\LIB\GTKGLEXT-1.0\INCLUDE"  -I"D:\Dev-Cpp\INCLUDE\LIBGLADE-2.0"  -I"D:\Dev-Cpp\INCLUDE\LIBXML2"  -I"d:\Dev-Cpp\include\c++\3.3.1"  -I"d:\Dev-Cpp\include\c++\3.3.1\mingw32"  -I"d:\Dev-Cpp\include\c++\3.3.1\backward"  -I"d:\Dev-Cpp\lib\gcc-lib\mingw32\3.3.1\include"  -I"d:\Dev-Cpp\include"  -I"D:\Dev-Cpp\include\glibmm-2.4"  -I"D:\Dev-Cpp\include\gdkmm-2.4"  -I"D:\Dev-Cpp\lib\gtkmm-2.4\include"   -L"D:\Dev-Cpp\LIB" -L"d:\Dev-Cpp\lib"
In file included from D:/Dev-Cpp/include/gtkmm-2.4/gtkmm.h:29,

                 from D:/Dev-Cpp/我/test.cpp:1:
D:/Dev-Cpp/include/glibmm-2.4/glibmm.h:25:26: glibmmconfig.h: No such file or directory
In file included from D:/Dev-Cpp/include/glibmm-2.4/glibmm/containerhandle_shared.h:34,
                 from D:/Dev-Cpp/include/glibmm-2.4/glibmm/arrayhandle.h:24,
                 from D:/Dev-Cpp/include/glibmm-2.4/glibmm.h:27,
                 from D:/Dev-Cpp/include/gtkmm-2.4/gtkmm.h:29,
                 from D:/Dev-Cpp/我/test.cpp:1:
D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:32:26: glibmmconfig.h: No such file or directory
In file included from D:/Dev-Cpp/include/glibmm-2.4/glibmm/containerhandle_shared.h:34,
                 from D:/Dev-Cpp/include/glibmm-2.4/glibmm/arrayhandle.h:24,
                 from D:/Dev-Cpp/include/glibmm-2.4/glibmm.h:27,
                 from D:/Dev-Cpp/include/gtkmm-2.4/gtkmm.h:29,
                 from D:/Dev-Cpp/我/test.cpp:1:
D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:33: error: `
   bidirectional_iterator_tag' was not declared in this scope

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:34: error: ISO C++ forbids
   declaration of `GLIBMM_USING_STD' with no type

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:34: error: syntax error before `
   (' token

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:57: error: `T' is not a class or
   namespace

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:57: error: `value_type' is not a
   class or namespace

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:57: error: using `typename'
   outside of template

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:57: error: `T' fails to be a
   typedef or built in type

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:57: error: ISO C++ forbids
   declaration of `value_type' with no type

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:58: error: `T' is not a class or
   namespace

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:58: error: `difference_type' is
   not a class or namespace

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:58: error: using `typename'
   outside of template

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:58: error: `T' fails to be a
   typedef or built in type

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:58: error: ISO C++ forbids
   declaration of `difference_type' with no type

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:59: error: `T' is not a class or
   namespace

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:59: error: `pointer' is not a
   class or namespace

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:59: error: using `typename'
   outside of template

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:59: error: `T' fails to be a
   typedef or built in type

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:59: error: ISO C++ forbids
   declaration of `pointer' with no type

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:60: error: `T' is not a class or
   namespace

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:60: error: `reference' is not a
   class or namespace

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:60: error: using `typename'
   outside of template

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:60: error: `T' fails to be a
   typedef or built in type

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:60: error: ISO C++ forbids
   declaration of `reference' with no type

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:61: error: syntax error before `
   }' token

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:65: error: `IteratorTraits' is

   not a template

D:/Dev-Cpp/include/glibmm-2.4/glibmm/ustring.h:66: confused by earlier errors, bailing out

执行结束
回复 支持 反对

使用道具 举报

发表于 2005-12-10 21:08:50 | 显示全部楼层
怎么是Windows用的
回复 支持 反对

使用道具 举报

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

本版积分规则

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