GTK+graphical application to develop learning notes (1) – Overview
1, what is
The meaning ofGNOME、
GNOMEmeans “GNU Network Object Model Environment”(GNUnetwork object model environment), yesLinuxThe exciting software development results of the world. Although its name is relatively long, the purpose of this software project is very simple, that is, to achieve an eternal friendly, powerful user and development desktop environment, and this environment is completely based on free open source code software Essence
As it is named,GNOMEis both a desktop and a complete programming environment.GNOMEis the bottomXwindow system and a program design interface between the high -level manager software, it towardsGUIProgrammer provides rich functions and powerful development tools. These tools are in the traditional senseLinuxLack.
2, what is
The basic toolkit inGIMP、GTK+
GNOMEisGTK+((GIMPTool package), it was originally to simplify
The development ofGIMPwas written.
GIMPYesUNIXVideo processing program on the operating system.GIMPis a general image processing program orGNUVictoring Program Abbreviation. Its function is similarWindowsPhotoshop。
GTK+is an excellent performance, object -oriented, cross -platform development tool package that does not depend on specific language, inGNOMEBefore appearing, it has been largely used to develop various software programs.GTK+can support many programming languages, includingC、C++、TOM、PERL、Python、GUILE、ADAet al.
3,GTK+Library used
GTK+UseGLIB#GDK(GIMP Drawing Kit,GIMPDrawing Tool Pack) Series Development Library,GLIBDefine the data type, provides functions in error processing and memory management;GDKis the map of this mapAPIand
A transition layer in the middle ofGTK+ , it needs to rely on specific computer platforms. Therefore, transplant on other computer platformsGTK+ Only need to be rewrittenGDK。
Four,GTK+Installation
Generally speakingRedhatFull installation and bringGTK+Tool library. Everyone can develop the program directly. If the current system is notGTK+Tool library, you can getwww.gtk.org.download source code installation. Specific installation method can. SeeCUGTK+ 2.0Installationposts, no longer described here.
inspection system
The method ofGTK+ 2.0is
$ pkg-config –modversion gtk+-2.0
5. UseGTK+Tool set writing program
The following is a simple useGTK+Library editor’s program, the purpose is to let everyone experienceGTK+The fun of programming.
/*base.c*/ #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 FALSE; } |
Below we compile it:
$ gcc -o base base.c ‘pkg-config –cflags –libs gtk+-2.0’
Pay attention topkg-config –cflags –libs gtk+-2.0The two things next to the single quotation number are actually not single quotes, it is the number key1The symbol on the left. Everyone must pay attention. If a single quotation compiler will prompt youpkg-config –cflags –libs gtk+-2.0There is no file or directory.
Let’s run below:
$./base
The name will appear after running the program.basewindow.
Everyone can feelGTK+ program and ordinaryCThe language program is no different, it is just calledGTK+Tool library.