How to create a GUI(Graphical User Interface) using C programming Language..

12 08 2011

How to create a GUI(Graphical User Interface) using C programming Language???  That was a big problem to me when I’m in the University first year. I knew Java GUI Designing, but couldn’t find way to do it in C language. I spent many time to learn that. I think now it’s time to share those knowledge😀. But since there are lot to discuss on that topic, I’m going to spelt the whole tutorial into several posts.  In this post I’ll discuss how to set up the development environment.

Setting up the development environment for C language GUI designing.

Ok let’s begin. First we need to have several tools for that.

1) Code Blocks IDE

2) Glade IDE

3) Gtk+

4) Libglade library

So install those things on your computer. I’ll give a hint to get it much easier. If you are Ubuntu user, go to Ubuntu software center or Synaptic package manager. Find code blocks and install. Then Find for Glade and before install, check all the Add-ons then install. In this way it will automatically install gtk+ and libglade. So you don’t want to worry about that:D.

A screen shot of Code Blocks IDE..

Now you have to configure Compiler and Debugger settings in Codeblocks IDE.

  • Open Code Blocks–> goto Compiler and Debugger settings

  • Select Other options in Compiler settings tab and paste this.

            `pkg-config –cflags gtk+-2.0 gmodule-export-2.0`
            `pkg-config –cflags libglade-2.0`

  • Then select Other linker options in Linker settings tab and paste this.

           `pkg-config –libs gtk+-2.0 gmodule-export-2.0`
           `pkg-config –libs libglade-2.0`

A screen shot of Glade Interface designer…


But you always free to compile your program on the terminal too. If you wish to do so it should be like this.

gcc `pkg-config –cflags libglade-2.0 –libs gtk+-2.0“pkg-config –libs gtk+-2.0 gmodule-export-2.0` main.c

Ok thats all for now . In next post I’ll explain how to Design a GUI using Glade Interface Designer😀.

 

Thank you

Gihan Malan De Silva @ gihansblog.com


Actions

Information

12 responses

12 08 2011
තාරා

wow…. great…..

25 08 2011
Cupon Hostgator

It’s really a great and useful piece of information. I’m happy that you just shared this useful information with us. Please keep us informed like this. Thanks for sharing.

25 08 2011
Mary Uhr

Hey, your review above surely got me interested up to the very last word, so I just had to comment on it. Luckily I noticed it over Google and I must confess to you I rarely read the entire article of a blog as I more or less always get bored of the “gibberish” which is offered to me on a almost daily basis. In contrast your article got me hooked from the tag-line to the very end. Really unique these days in the blogging world (if you ask me). Consequently: thanks a lot and please please go on with your good work. I’ll surely come back and look for new stories! Happy Blogging

27 08 2011
Cupon Hostgator

I’ve recently started a web site, the info you provide on this site has helped me tremendously. Thanks for all of your time & work.

28 08 2011
sliding interior doors

Would you be considering exchanging links?

5 09 2011
hooher tod

Yes there should realize the reader to RSS my feed to RSS commentary, quite simply

9 09 2011
greg

I would really like to see a tutorial for gtk3 with css

9 05 2012
Vernon

Pls, how would I do this for Windows7 ?
Thanks…vmars316

24 06 2012
sadi

Hey, I am using windows 7,
i’ve installed codeblocks, glade IDE+gtk,
and did what you’ve ask to do in codeblocks.
but how can i install libglade library??
please help.

11 10 2012
nalin

I didn’t get any setup’s with glade IDE,Gtk+ & libglade library😦

24 12 2012
sanisoni

how to install libglade on windows?

26 01 2013
Afsar Habib

how to install gtk+2 and glade. please reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: