LINUX/BSD - PROGRAM EXAMPLE 1

1/28/06

This is a very simple minded program that demonstrates that you can write, compile, and link a C program in LINUX.

Create a file named "demo1.cpp" with the contents shown in the box:

#include <stdio.h>
int main(void)
{
printf("Hello, World!\n");
return 0;
}

Now type
g++ -o demo1 demo1.cpp
This will compile and link demo1.cpp into the executable file demo1
Now type
demo1
and the phrase "Hello, World!" should now appear