Use your text editor to create the source program. Call the file
Copy the following lines.
Be sure to get all of the punctuation right.
Then when you are satisfied that it is correct, save the file. Do not
exit the editor yet, however. In your
xterm window, compile it
with the command
g++ hello.cc -o hello
Be sure to include spaces exactly as shown. The command causes the
hello.cc to be compiled and linked. The result of this
operation is placed in an executable file called
hello. If you didn't specify the output file with the
-o flag the compiler would call it
a.out, which isn't very mnemonic.
If the compilation is unsuccessful, return to the emacs window and fix your program. Save your edits and then rerun the compilation.
When the compilation is successful, run your program with the command
You should see the message, ``Hello, world.'' printed on your screen.
When you are finished, exit the editor.