6

Is it possible to debug our programs written in c by gedit text editor ? If not, how can i do it ?

6
  • 1
    Close voters: The question is not off-topic because it relates to software that comes with Ubuntu. It does not ask general programming type of question ! Feb 1, 2016 at 14:31
  • thats true sorry about it i was just wondering if it is possible to do that !
    – Artnect
    Feb 1, 2016 at 14:35
  • Nothing to be sorry about - you're in the right place, everything is OK Feb 1, 2016 at 14:36
  • Do you know what are those third-party debugger plugins for python ? i mean this : wiki.gnome.org/Apps/Gedit/ThirdPartyPlugins-v3.0 @Serg
    – Artnect
    Feb 1, 2016 at 14:44
  • From what I read , most of those are markup and editing plugins, indentation plugins, but there is one for debugging. Never tried none, though. Personally I use vim and command line compilers/interpreters for 99% of the stuff I do. Feb 1, 2016 at 14:48

3 Answers 3

9

gedit is a text editor - it will color the syntax but won't help you compile or debug it. What I suggest you use is geany. It is a very simple, very easy to use IDE, which you can use to write,compile, and debug. It's available through either Software Center or sudo apt-get install geany

2
  • Besides geany there is MS visual studio (or visual code?) which is getting good reviews as of late. Sorry don't have the link nor remember the product names exactly. Another +1 though for saying it can't be done in gedit :) Oct 10, 2018 at 23:15
  • BTW I added an answer on what gedit can do, evenh it isn't much compared to professional editors like geany. However it is addressing OP's question which I think it is fair. Oct 11, 2018 at 1:06
1

Gedit Plug-ins

Use gedit external terminal plug-in

You can use gedit with terminal plugin. The steps are fairly straight-forward:

  1. Enable "Universe" repository
  2. Install gedit-plugins
  3. Activate "Embedded Terminal"
  4. Use Ctrl+F9 to open terminal
  5. Other gedit plug-ins

Step 1. Enable "Universe" repository

The first step is to ensure Universe repository is activated from Settings->Software & Updates->Ubuntu Software and ensure the third option is checked:

gedit plugins repository.png

Step 2. Install gedit-plugins

Install gedit-plugs with the command:

sudo apt install gedit-plugins

Step 3. Activate "Embedded Terminal"

Open gedit (don't use sudo) and select Edit->Preferences->Plugins and check off Embedded Terminal:

gedit embedded terminal.png

Step 4. Use Ctrl+F9 to open terminal

In the GIF below we use Ctrl+F9 to get a tiny window with the command prompt. Use the mouse to click and drag the dividing line up to reveal an approximate size of 24x80.

The colors are dreadful! (with default gedit color scheme). I was just learning this as creating the answer so my mouse movements are slow below...

gedit open terminal.gif

Step 5. Other gedit plug-ins

As mentioned in Step 4., you can grab the separator bar to make the terminal window bigger. Here's what it looks like in a normal picture ((not a GIF).

There are three other plug-ins I currently use in the gedit coding window:

  • plug-in to display 80 character cut-off with different background color
  • plug-in to display entire document in thumbnail you can drag to quickly go to code section
  • Highlight matching brackets

Additionally there is an external add-on I'd like to install for shellcheck linter / checker that shows bash code errors. I haven't searched for a lint checker for other languages but obviously you can enter gcc and other commands directly into gedit terminal window.

gedit teriminal line wrap.png

For further reading please see:

2
  • Code highlighting plugins can be useful for debugging syntax and having console open next to editor is pretty much what all IDEs do, so to some extent you have turned gedit into an IDE. Very nice Oct 11, 2018 at 4:58
  • @SergiyKolodyazhnyy As always thanks for the complement and no doubt sole up-vote. I added a link in this answer to a new answer just posted on C/HTML/CSS Code Completion using gedit with snippets plug-in. Highly useful and popular plug-in: askubuntu.com/questions/1084602/code-completion-for-gedit/… Oct 17, 2018 at 23:48
0

gedit your required file.c creates a new file ,where you can type your code. You can debug it by compiling the code

If you are using gcc compiler then cc your program.c

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .