Gedit is only designed to be a really good editor, not an IDE.
If you have a proper makefile then I believe F8 or F9 is the shortcut key to have gedit run 'make' in the current directory...
Otherwise just switch to the shell prompt and run the GCC yourself:
% g++ -Wall myprog.cpp -o myprog
% ./myprog
|
The first line compiles "myprog.cpp" into an executable named "myprog" (instead of "a.out").
Assuming there are no errors, the second line executes your program.
If your shell is locked because you started gedit with
% gedit myprog.cpp
instead of
% gedit myprog.cpp &
then you can fix it by:
1. Make sure the terminal window is active
2. Press Ctrl+Z to suspend the foreground process (gedit)
3. Type
% bg 1
to move job 1 (your gedit process) to the background.
If you have more than one process running, you can learn the job number by asking
% jobs