First of all, you don't need the lines
using namespace std;
in either of your class files (rect.cpp and rect.h), because you're not using them in there. Also, you haven't declared the function area() in your class, so your program isn't going to compile.
Secondly, you need to use g++ to compile. You need to pass the main file as well as the class implementation file:
g++ rect_main.cpp rect.cpp -o rect_main
The -o option here sets the name of the executable file. If you don't use it, the executable will be called a.out. Edit: to run the executable, you simply do ./rect_main (the '.' is necessary here, because the current directory (for which '.' is shorthand) is not likely to be in your PATH).
Last edited by Nylex; 05-25-2010 at 02:46 AM.