Ubuntu + eclipse + GTK environment Configuration

Source: Internet
Author: User
Tags gtk

The occasional idea is to play with GTK, because QT is the c ++ encapsulation of GTK, And the execution efficiency of GTK should be higher than that of QT. Next, let's share our own setup process.

 

1. Eclipse + CDT is installed on my Ubuntu Virtual Machine. If eclipse is installed without CDTInstall CDT:
. You can enter the following address in eclipse Update to install: http://download.eclipse.org/tools/cdt/releases/ganymede

You can also download the CDT master update: http://download.eclipse.org/tools/cdt/releases/ganymede/ and then select the local path in eclipse Update to install CDT. The specific path is: help --> Software Updates --> available software, select Add site --> local, and then import the downloaded CDT master. Finally, select CDT in the list on the left, right-click and select install.

 

2. Install related dependency packages

1 sudo
apt-get
install
gnome-core-devel
2 sudo
apt-get
install
libglib2.0-doc libgtk2.0-doc
3 sudo
apt-get
install
devhelp
4 sudo
apt-get
install
glade-gnome glade-common glade-doc
I did not install the above several, I directly run sudo apt-Get install libgtk2.0-dev libgnome2-dev, this command is not executed, the system prompts you need to upgrade the update before you can, after the update operation, run the command and the installation will soon be successful. In the terminal test, $: PKG-config -- modversion GTK +-2.0 output: 2.20.1

If it is compiled directly in the terminal, you can easily input the include and Lib dependencies of GTK +, that is, add'Pkg-config -- cflags -- libs GTK +-2.0 '(Note:' This symbol is the one signature key, and a space is added before this character ).

For example, GCC-O testgtk 'pkg-config -- cflags -- libs GTK +-2.0 'testgtk. c

 

3. The development efficiency in eclipse is slightly higher. Usage:Create a Project New-> C Project, and configure the project as follows:
In Project-> properties-> C/C ++ build, set ting: append 'pkg-config -- cflags -- libs GTK +-2.0 'to the other flags of miscellaneous under gcc C Complier (note that' this symbol is the key of the 1 signature, add a space before this character ). Same Method
In gcc
Add linker flags under miscellaneous under C linker'Pkg-config -- cflags -- libs GTK +-2.0 '(Note:' This symbol is the one signature key, and a space is added before this character ). In addition, right-click the project and choose Properties> C/C ++.
Build-> Settings-> gcc C compiler-> directories, add/usr/include/gtk-2.0 and/usr/include/glib-2.0 this is for smart tip convenience.

 

4. Test Procedures

 

#include <gtk/gtk.h>
int
main(
int argc,char
*argv[]) {
GtkWidget *window;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_show(window);
gtk_main();
return
0;
}

Finally, a good GTK + Tutorial:

Http://zetcode.com/tutorials/gtktutorial/chinese/

 

Related Article

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.