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

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 :D. 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 :D.


Thank you

Gihan Malan De Silva @


  1. Reply
    තාරා August 12, 2011

    wow…. great…..

  2. Reply
    Cupon Hostgator August 25, 2011

    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.

  3. Reply
    Mary Uhr August 25, 2011

    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

  4. Reply
    Cupon Hostgator August 27, 2011

    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.

  5. Reply
    sliding interior doors August 28, 2011

    Would you be considering exchanging links?

  6. Reply
    hooher tod September 5, 2011

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

  7. Reply
    greg September 9, 2011

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

  8. Reply
    Vernon May 9, 2012

    Pls, how would I do this for Windows7 ?

  9. Reply
    sadi June 24, 2012

    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.

  10. Reply
    nalin October 11, 2012

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

  11. Reply
    sanisoni December 24, 2012

    how to install libglade on windows?

  12. Reply
    Afsar Habib January 26, 2013

    how to install gtk+2 and glade. please reply

  13. Reply
    Allen Z. Morgan June 21, 2013

    does the same thing as a GUI site install: that is, it only installs local install profiles and does not update. The reason is presumably installation profiles are designed and tested around specific versions of modules.

Leave a Reply