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.

`pkg-config --cflags gtk+-2.0 gmodule-export-2.0`
`pkg-config --cflags libglade-2.0`
`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 @ gihansblog.com

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 @ gihansblog.com
wow.... great.....
ReplyDeleteIt'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.
ReplyDeleteHey, 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
ReplyDeleteWould you be considering exchanging links?
ReplyDeleteYes there should realize the reader to RSS my feed to RSS commentary, quite simply
ReplyDeleteI would really like to see a tutorial for gtk3 with css
ReplyDeletePls, how would I do this for Windows7 ?
ReplyDeleteThanks...vmars316
Hey, I am using windows 7,
ReplyDeletei'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.
I didn't get any setup's with glade IDE,Gtk+ & libglade library :(
ReplyDeletehow to install libglade on windows?
ReplyDeletehow to install gtk+2 and glade. please reply
ReplyDeleteHey! if i implement a program using code block,can i run it in linux environment?
ReplyDeleteReblogged this on GHABEZ.
ReplyDeleteAwesome post - Thank u
ReplyDeleteDownload the "binary" if available
ReplyDeleteExcellent, thank you for your efforts. Good luck in the future..
ReplyDeleteIt became to much helpfull for me in creating gui output genarating programe in c++ as a beginner.
ReplyDelete[…] https://gihansblog.wordpress.com/2011/08/12/how-to-create-a-guigraphical-user-interface-using-c-prog… […]
ReplyDelete