I installed GTK in my ubuntu-9.10 desktop. With build essentials already with my system, I issued the following command at the terminal to install GTK+-2.0:
sudo apt-get install libgtk2.0-dev libgtk2.0-doc devhelp
libgtk2.0-dev installs the GTK library. libgtk2.0-doc and devhelp installs the documents of GTK and the browser for the documents respectively.
I wrote a simple hello world program. The program was written to create a window with a button on it. The button would have the label "Hello, World! Bye...". And once the button is clicked, the application would quit.
Download: helloworld_gtk.c
Compiled the hello world program and built the executable for the same by issuing the following command at the terminal:
gcc helloworld_gtk.c -o helloworld `pkg-config --cflags --libs gtk+-2.0`
Here,
- pkg-config is the program that reads the .pc which comes with GTK to determine what compiler switches are needed to compile programs that use GTK.
- pkg-config --cflags gtk+-2.0 will output a list of include directories for the compiler to look in
- pkg-config --libs gtk+-2.0 will output the list of libraries for the compiler to link with and the directories to find them in.
No comments:
Post a Comment