First things first, download everything you need.
Download GTK from GTK.org -- I downloaded gtk+-bundle_2.18.7-20100213_win32.zip.
Optionally, download libiconv from GTK.org -- as of this writing libiconv is version 1.9.1.
For C editor, I am using MinGW Developer Studio. It is the easiest to setup in compiling GTK+ applications since it already works well with MingGW, the recommended toolchain when using GTK. Sadly, the developer's website is somewhat down or possibly currently doing a revamp. But you can easily get version 2.0.5 from list of mirrors courtesy of TextEditors.org.
Setting them up
Install MinGW Developer Studio.
Extract gtk+-bundle_2.18.7-20100213_win32.zip then place content in C:\Gtk+\{here}
Same with libiconv, extract libiconv-1.9.1.bin.woe32.zip then place all contents in C:\Gtk+\{here}
Configuring MinGW Develop Studio.
- Launch the editor
- Click Edit -> Options... to open the Option dialog box.
- Click the Directories tab
- On Show directories for,
- select Include files then add the following paths:
- C:\Gtk+\include
- C:\Gtk+\lib\glib-2.0\include
- C:\Gtk+\lib\gtk-2.0\include
- C:\Gtk+\include\cairo
- select Library files then add this path:
- C:\Gtk+\lib
- Launch MinGW Developer Studio
- Click Project -> New Project to open New dialog box.
- Select GTK+ Application and indicate HelloGTK as Project Name
- Click OK to create new project.
- Click File -> New to open New dialog box.
- Select C/C++ Source File and indicate hellogtk.c as File name.
- Click OK to create new file.
- Type in the code below then press F5 to compile and run the program.
If you are having problem running you hellogtk application, you might need to install GTK+ runtime. I use GIMP, which installs the runtime -- try to download and install a copy of GIMP for Windows.
Where to go from here? Read the official documentation and tutorials.
No comments:
Post a Comment