installation, compilation and testing of gtk3.xx under Ubuntu12.04

Source: Internet
Author: User
Tags gtk

Use this method to successfully install GTK 3.xxx under Ubuntu 12.04.

First, installation

1, install Gcc/g++/gdb/make and other BASIC programming tools

$sudo Apt - Get Install build - Essential

2, installation Libgtk3.0-dev Libglib3.0-dev and other development-related library files

$sudo Apt - Get Install Gnome - Core -

3, used in compiling GTK program to find out their own files and library file location

$sudo Apt - Get Install pkg - Config

4. Install devhelp GTK Document Viewer Program

$sudo Apt - Get Install Devhelp

5. Install Gtk/glib API Reference manual and other help documents

$sudo Apt - Get install LIBGLIB2. 0 - Doc Libgtk2. 0 - Doc

6. Installing GTK-based interface GTK/C + + language graphics library for developing GNOME forms

$sudo Apt - Get Install glade Libglade2 - Dev
Or
$sudo apt-get Install glade-gnome Glade-common glade-doc

7, install gtk3.0 or gtk+3.0 all required files Shitong Download installation complete

$sudo Apt - Get Install LIBGTK3 - Dev
Or
$sudo Apt-get Install libgtk3*

  

Second, view the GTK library version number

1. View 1.2.x Version number

$pkg -  --modversion gtk+

2. View 2.x version number

$pkg -  --modversion gtk+-3.0

3. View Pkg-config Version number

$pkg -  --version

4. See if GTK is installed

$pkg -  --list-All| grep gtk

  

Third, test procedure

Helloworld.c#include <gtk/gtk.h>int Main (int Argc,char *argv[]) {Gtkwidget *window;        Gtkwidget *label;        Gtk_init (&AMP;ARGC,&AMP;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 was about to be destroyed we get a Notif        Ication 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, is visible */gtk_widget_show_all (window);        /* Start the main loop, and let it rest until the application is closed */Gtk_main (); return 0;}



Iv. Compile and Execute

1. Compiling

- o Helloworld helloworld.c ' pkg -   ----Libs GTK +-3.0 '

2. Implementation

$. / Helloworld


Installation, compilation, and testing of gtk3.xx under Ubuntu12.04

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.