Take the 2-minute tour ×

I would like to learn how to make a text editor using GTK+. I think the best way to do this is to watch what is happening in the code when one runs Gedit. I have been told that one has to compile the sources of Gedit and GTK+ for -g option. But as I am a very beginner of open source world, I would like to know

  1. How can I load the sources of GTK+ and Gedit to my computer?
  2. How to compile them to one package which can run on debugger?
  3. How to run the Gedit and debugger so that I can see what is going on when one runs the program?

I'm using Ubuntu 10.04. I haven't done debugging earlier so I thought that DDD or Nemiver would be the easiest to learn but any suggestions are welcome.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

For Ubuntu, simply do:

cd ~/Desktop  # or wherever you want it
apt-get source gedit  # does not need sudo

Check the README / INSTALL files - they should give you plenty information about compiling, just adapt the instructions to your needs. For a simple compile it's just:


The GEdit main development page is at: http://git.gnome.org/browse/gedit/
You can get the upstream source code using git clone git://git.gnome.org/gedit

share|improve this answer
OK. I compiled the program as sudo ./configure CFLAGS=-g sudo make cd gedit/ But now ddd ./gedit shows the code but how can I run it line by line. –  beginnerdebugger Jul 30 '10 at 16:09

You should use ./configure --enable-debug so it contains debug information in the first place (usually, C executable don't which is why they are so small). So to correct the above from what you have now: make clean ./configure --enable-debug make

In DDD, F5 is step, F6 is next, F8 is finish and you can set breakpoints.

share|improve this answer

Your Answer


