After learning about GTK +, the following describes how to build an environment for GTK + learning. The environment can be set up on two platforms: Windows and Linux: At [url] http://www.gtk.org/download.html#/url]
Yes
To download the windows (32-bit) and 64-bit versions, select the corresponding version based on whether your system is 32-bit or 64-bit. The GTK +
Individual packages is a required library for GTK + running, third party
Dependencies is a third-party dependent library. In this way, we can download the corresponding library files as needed to minimize the number of GTK + libraries. For simplicity, the page also provides
Bundle package. This package all libraries together. You can download this package. Note that the bundle package is not listed separately, but the link provided in the page body. You may need to look for it carefully. Here we download the bundle package. After decompression, we can add the bin folder to the environment variable path so that we can find
Some DLL. Otherwise, copy these DLL files to the same directory as the EXE file. You can also copy all the DLL files in the bin to the C:/Windows/system32 folder.
, Because even if you add these to the system environment variables, you cannot find the DLL in the IDE. Copy it to the System32 folder. The following uses vc6 to configure the compiling environment. First, select include files under the tools-options directory of vc6, add the include folder under the GTK + directory and all the first-level subdirectories in it, and then add the include folder in the subdirectory under the Lib folder, in this case, a total of 10 directories are added: Then, add the Lib folder under the GTK + directory in the library files: After that, vc6 is configured, and vs2008 is similar. Create a console Project (vc6) or an empty project (vs2008 ).
Settings, clear the original object/library modules in the Link tab, and then add the glib-2.0.lib
Gtk-win32-2.0.lib gdk-win32-2.0.lib gobject-2.0.lib gdk_pixbuf-2.0.lib
Gthread-2.0.lib gmodule-2.0.lib intl. Lib
A few. OK. Vc6 and vs2008 are used here. After this setting, you can create a new main. c file, and enter: # include <GTK/GTK. h> int main (INT argc, char ** argv) {gtkwidget * window;
Gtk_init (& argc, & argv );
Window = gtk_window_new (gtk_window_toplevel );
G_signal_connect (gtk_object (window), "Destroy", g_callback (gtk_main_quit), null );
Gtk_widget_show (window );
Gtk_main ();
Return 0;} compile, link, and run. If a window appears, it indicates that the environment is configured successfully: Linux platform: first, declare that I use Ubuntu for Linux and gnome for desktop. As mentioned earlier, gnome is written using GTK +. Therefore, the runtime environment does not need to be configured separately. The environment required for installation and development is required. The installed Ubuntu has installed GCC by default, but does not install the required header file. We need to manually add: sudo apt-Get install build-essential and then install gnome: the sudo apt-Get install gnome-core-devel System Automatically finds the dependent libraries and downloads them together. After installation, use the following command to compile the above Code: GCC main. c-o main 'pkg-config -- cflags -- libs GTK +-2.0 Note: 'Here is the back quotation marks on the left side of the keyboard, not single quotation marks. It is unclear how to configure GTK + on the KDE Desktop. The steps may be similar, but do you need to install the running environment of GTK + first? The above is the GTK + Environment configuration on Windows and Linux platforms. These steps have passed the test on my machine. After the environment is configured, we will start to learn new things.
This article is from "bean space"
Blog, be sure to keep this source http://devbean.blog.51cto.com/448512/108092