You can compile and run it from the unix prompt as follows :#include <stdio.h> void main (){ printf("Hello World\n"); }
This creates an executable called "a.out". You can run it by typing% g++ helloworld.C
Since no executable name was specified to g++, a.out is chosen by default. Use the "-o" option to change the name :% ./a.out
creates an executable called "helloworld".% g++ -o helloworld helloworld.C
AddThis basically tells g++ to look for #include's in /homes/me/include in addition to other directories you specify with -I#include <foo.h>to helloworld.C and compile it with the -I option :% g++ -o helloworld -I/homes/me/randomplace/include helloworld.C
The first three commands generate foo.o, main.o and bar.o respectively. The last line links them together along with the math library, libm.a.% g++ -c -o foo.o foo.C % g++ -c -o main.o main.C % g++ -c -o bar.o bar.C % g++ -o fubar foo.o main.o bar.o -lm