Monday, June 22, 2009

how to run a GTK based GUI program in linux

Running a GUI program in linux is much easier than that in windows.
here all the requirements for running a GTK program is installed with the operating system.
For example I ran GTK program in Fedora 10.
first I have checked whether my Fedora 10 system supports gcc compiler.
i wrote a simple c program and compile that program by writing the following command in terminal:
gcc test.c
it produced a output file name a.out.
then just typed ./a.out and this ran the c program.
after that i have checked whether my system has GTK installed.
to check that i issued a command in the terminal

rpm -q GTK2
this gives me the result.
gtk2-2.14.4-3.fc10.i386

I tested all other dependencies in the same way.
And finally when i found that my GTK and all other related packages are installed then i issued a command to run a GTK based program.

gcc te.c -o out1 `pkg-config --cflags --libs gtk+-2.0`

this gave a output file name out1
when i ran the out1 using ./out1 in the terminal i found my GTK program is running perfectly.






No comments:

Post a Comment