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 MethodIn 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
|
int main(
int argc, char
*argv[]) { |
|
window = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
Finally, a good GTK + Tutorial:
Http://zetcode.com/tutorials/gtktutorial/chinese/