Inspirated

 
 

September 29, 2007

My first GTK+ application

Filed under: Blog — krkhan @ 6:24 pm

Ever wondered what’s the equivalent of ‘Hello World’ in the GUI world? (Besides just displaying a ‘Hello World’ label that is.) Here’s the answer: Tic Tac Toe. Now anyone may disagree with the ‘Hello World’ part for a number of reasons but no one can actually deny the fact that building a Tic Tac Toe app is a good introductory GUI exercise for anyone who has never stepped outside the console world (and that does not include TUI’s — if you’re thinking curses). TTT may be a boring game to play, but it’s rather fun for a newbie to develop as means of getting familiar with the basics of GUI programming. Here‘s my first attempt, which you can compile using the following command line:

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

Of course, the above command assumes that you have the development headers of GTK+ installed on your system (and that you’re somehow interested in compiling an utterly useless application just for the sake of it). Apart from being a good read for other GTK+ newbies, the program doesn’t do much. Nevertheless, if you do decide to analyze the code and find out instances where my programming practices start resembling those of a haywire baboon (or a Microsoft developer — which is actually the same thing anyway), please oblige me by pointing them out using the comments form of this post.

Tags: , ,