I have an answer for this one ... wanted to share.

The question comes up with some regularity. For me it came up because I was teaching a beginner to code in C / C++ on his Ubuntu box, but they had already been spoiled by limited exposure to a Windows IDE.

You mean you have type gcc at the command line ... and then you have to type the program name to execute it? Why can't I just hit a button?

The answer is that IMHO, teaching a development environment to a beginner before you teach them C makes things harder, not easier. So what you want for a beginner is something as dirt simple as possible, that does not interpose itself between them and their code.

I attach my answer ... and am eager for other contributions.

asked 14 Jun '10, 05:46

pcardout's gravatar image

accept rate: 46%

edited 16 Jan '11, 05:38

If you found an answer, please accept this answer via the tick next to the answer. You don't need to put "SOLVED" in the title.

(14 Jun '10, 08:20) guerda

IMHO, the rookie must understand what a shell is, an ASCII file-C program and how to run gcc. This is before he attempts anything. This urge to "Why can't I just click?" irks me. Once he grasps a few basics, he will need a real IDE that can be used to throw up an X window or whatever. Skip the IDE it spoils noobs, I still don't use one........don


answered 14 Jun '10, 21:27

don's gravatar image

accept rate: 100%

I agree with you Don. My little hacked scripts actually show what you would be typing at the command line to try to take the fear away. My view as a teacher (and a Dad) is to do whatever it takes to get them going. Once he starts, he'll see the simplicity of the command line. OTOH -- Now that I've got "Compile_and_Execute" working -- it's pretty cool, and for hacking a single file over and over again, which is what beginners do, it does save time.

(15 Jun '10, 01:25) pcardout

Also, taking your hand off the keyboard to find the mouse and using additional hand-eye-coordination and mental focus to click the icon takes more time and effort and is more distracting than just touch-typing "make".

(07 Nov '13, 06:28) KenJackson

I was inspired by this thread:

Compiling and running straight from gedit

I like this solution because the beginner does not need to learn vim or emacs before starting to program. gedit (gnome-edit) is dead simple to use for most beginners who like pointing, clicking, cutting and pasting. Nonetheless, gedit does have syntax highlighting and parenthesis-matching (you need to turn bracket-matching on in your prefs.); certainly features that no programmer should do without. (Pity the poor Windows noobs who use Notepad). Further, gedit DOES have the ability for one click compiling and running -- it's just implemented in user scripts. So -- I explain the script system and provide some samples. After this you have a development environment that a beginner can use. I do assume that you are helping your beginner set this up.

  1. Click Edit\Preferences, go to Plugins tab, and enable External Tools.
  2. Go to Tools\External Tools and select New. A window will open with description A Brand New Tool.
  3. Go down to the command and type echo Hello!.
  4. Now when you execute Tools\New Tool you will see Hello! in your Shell Output window.
  5. cd ~/.gnome2/gedit/tools; ls
  6. You will see one or more scripts labeled new-tool
  7. You can copy and edit these scripts to create new commands. Clearly you can do this through the interface mentioned in step 4, but you can't configure everything with that interface. In particular, you can't change the tool name, so that all your tools are called new-tool in the pull-down menu.
  8. To create your first script, which will execute a program in your root directory,
    cp new-tool execute in the directory you changed to in step 5.

Here is my execute script.

# [Gedit Tool] 
# Comment=Execute from current directory 
# Input=nothing
# Name=Execute
# Shortcut= Control>x
# Applicability=all
# Output=output-panel

echo -e "\nExecuting..." ;./${GEDIT_CURRENT_DOCUMENT_NAME%.*}

Here is my script called *CCompile_and_Execute*.

# [Gedit Tool] 
# Comment=C-Compile and Execute
# Input=nothing
# Name=C Compile and Execute
# Shortcut= Control>c
# Applicability=all
# Output=output-panel

echo -e "Compiling... \n"
echo -e "\nExecuting..."

A couple of notes:

  1. These are ordinary bash scripts, but they have access to special environment variables (like GEDIT_CURRENT_DOCUMENT_NAME) and there are other special variables.
  2. The comment lines in the scripts are actually recognized by gedit.
  3. Should you wish to use a different compiler, just change gcc to g++, or whatever.
  4. Now that you know how to directly edit these script files, you can add custom commands galore to gedit.
This answer is marked "community wiki".

answered 14 Jun '10, 06:37

pcardout's gravatar image

accept rate: 46%

edited 14 Jun '10, 08:19

guerda's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 14 Jun '10, 05:46

Seen: 7,575 times

Last updated: 07 Nov '13, 06:28

powered by OSQA