用此方法成功在UBUNTU 12.04下安装GTK 3.xxx。

一、安装

  1、安装gcc/g++/gdb/make 等基本编程工具

$sudo apt-get install build-essential

  2、安装 libgtk3.0-dev libglib3.0-dev 等开发相关的库文件

$sudo apt-get install gnome-core-devel 

  3、用于在编译GTK程序时自己主动找出头文件及库文件位置  

$sudo apt-get install pkg-config

  4、安装 devhelp GTK文档查看程序

$sudo apt-get install devhelp

  5、安装 gtk/glib 的API參考手冊及其他帮助文档

$sudo apt-get install libglib2.0-doc libgtk2.0-doc

  6、安装基于GTK的界面GTK是开发Gnome窗体的c/c++语言图形库

$sudo apt-get install glade libglade2-dev
或者
$sudo apt-get install glade-gnome glade-common glade-doc

  7、安装gtk3.0 或者 将gtk+3.0所需的全部文件统通下载安装完成

$sudo apt-get install libgtk3-dev
或者
$sudo apt-get install libgtk3*

  

二、查看GTK库版本号

  1、查看1.2.x版本号

$pkg-config --modversion gtk+

  2、查看 2.x 版本号

$pkg-config --modversion gtk+-3.0

  3、查看pkg-config的版本号

$pkg-config --version

  4、查看是否安装了gtk

$pkg-config --list-all | grep gtk

  

三、測试程序

//Helloworld.c
#include <gtk/gtk.h> int main(int argc,char *argv[])
{
GtkWidget *window;
GtkWidget *label; gtk_init(&argc,&argv); /* create the main, top level, window */
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); /* give it the title */
gtk_window_set_title(GTK_WINDOW(window),"Hello World"); /* connect the destroy signal of the window to gtk_main_quit
* when the window is about to be destroyed we get a notification and
* stop the main GTK+ loop
*/
g_signal_connect(window,"destroy",G_CALLBACK(gtk_main_quit),NULL); /* create the "Hello, World" label */
label = gtk_label_new("Hello, World"); /* and insert it into the main window */
gtk_container_add(GTK_CONTAINER(window),label); /* make sure that everything, window and label, are visible */
gtk_widget_show_all(window); /* start the main loop, and let it rest until the application is closed */
gtk_main(); return 0;
}

四、编译执行

  1、编译

$gcc -o Helloworld Helloworld.c `pkg-config --cflags --libs gtk+-3.0`

  2、执行

$./Helloworld





Ubuntu12.04 下 GTK3.xx 的安装、编译和測试的更多相关文章

  1. Ubuntu12.04下apache服务器的安装也配置

    安装步骤 1.下载httpd http://httpd.apache.org/ 2.解压缩httpd tar vxzf httpd-2.4.6.tar.gz 3.安装httpd 进入解压缩后的目录 c ...

  2. Linux (Ubuntu12.04) 下开发工具安装和使用

    Linux (Ubuntu12.04) 下开发工具安装和使用 这里讲述的是关于在ubuntu12.04下面安装和使用各种IDE 开发环境和初步使用的知识.说一下背景:很多的开发基本都是在linux操作 ...

  3. [置顶] ubuntu12.04下编译opencv程序

    ubuntu12.04下编译opencv程序 1.在ubuntu下安装好 opencv后(建议使用apt-get install 来安装) 2.使用程序FaceExaple.c来进行测试程序 #inc ...

  4. Ubuntu12.04下安装sourcenavigator-NG4.5阅读源代码

    大家知道Windows下有一个很好的查看源代码的软件sourceinsight,使用sourceinsight查看Linux内核代码.嵌入式软件开发中的C语言项目源代码.驱动程序代码很是方便.在Lin ...

  5. 阿里云ubuntu12.04下安装使用mongodb

    阿里云ubuntu12.04下安装mongodb   apt-get install mongodb 阿里云ubuntu12.04下卸载mongodb,同时删除配置文件     apt-get pur ...

  6. 在ubuntu12.04下编译android4.1.2添加JNI层出现问题

    tiny4412学习者,在ubuntu12.04下编译android4.1.2添加JNI层出现问题: (虚心请教解决方法) trouble writing output: Too many metho ...

  7. Ubuntu12.04下安ns-3.29及Ubuntu换源方法

    目录 1.下载ns-3.29 2.安装gcc-4.9.2 3.编译.测试ns-3.29 第一种:更新,文章开头说的 第二种,更新源 主机型号:Ubuntu12.04 仿真环境版本:NS-3.29 安装 ...

  8. ubuntu12.04下helloworld驱动从失败到成功过程

    最近在看linux的设备驱动程序,写一个简单的helloworld程序都花了我好久的时间,具体过程如下: 编写helloworld.c 编写Makefile 注意,makefile中的命令那里是一个t ...

  9. ubuntu12.04下NFS链接开发板并测试交叉编译的第一个应用

    思路:配置网络->安装NFS->配置NFS->挂载NFS服务->Down文件执行.Okay lets go! 配置网络: 在配置网络之前,首先咱得搞定与开发板的交互工作,那么这 ...

随机推荐

  1. ASP.NET Razor - C# Variables

    http://www.w3schools.com/aspnet/razor_cs_variables.asp Variables are named entities used to store da ...

  2. B1734 [Usaco2005 feb]Aggressive cows 愤怒的牛 二分答案

    水题,20分钟AC,最大值最小,一看就是二分答案... 代码: Description Farmer John has built a <= N <= ,) stalls. The sta ...

  3. js滚动

    有选择性的重复造一些轮子,未必是件坏事.Aaron的博客上加了一个悬浮菜单,貌似显得很高大上了.虽然这类小把戏也不是头一次见了,但是从未自己写过.今天就选择性的拿这个功能写一写.下面是这个轮子的开发过 ...

  4. linux编译安装protobuf2.5.0

    1.下载安装包 https://github.com/google/protobuf/releases?after=v3.0.0-alpha-4.1 找到相应的版本下载 2.解压安装包 #.tar.g ...

  5. ADO.NET改进防注入

    static void Main1(string[] args) { //用户输入一个需要查询的条件 car表 Console.WriteLine("请输入"); string c ...

  6. JVM概论

    引子 Java虚拟机是Java应用程序的执行环境.通常而言,JVM是由一组严格的指令集和一个复杂的内存模型来具体实现的虚拟机,它用来解释编译好的java字节码文件,将字节码转换为特定机器可以执行的本机 ...

  7. [] == ![]为什么是true

    我们先来考虑这个问题,console.log([] == false)会打印什么呢? 答案是true.为什么呢? 首先,因为当"=="号两边其中一个是布尔值的话,先把它转换为数字( ...

  8. Codeforces Round #446

    Greed #include<stdio.h> #include<string.h> #include<stdlib.h> #include<vector&g ...

  9. Python 之 基础知识(二)

    一.分支运算 在Python 2.x中判断不等于还可以用<> if语句进阶:elif if 条件1: ...... elif 条件2: ...... else: ...... 二.逻辑运算 ...

  10. APP开发过程的优惠券设计及流程

    在整个APP开发产品发展的整个周期中,运营活动必不可少,而发放优惠券已成为运营活动的一种基本形式,而关于优惠券设计的整体流程尤为重要.接下来,常州开发APP公司专家分享一下自己的经验,希望对大家有帮助 ...