doesntWork.cpp:9: error: ISO C++ forbids initialization of member 'x'
doesntWork.cpp:9: error: making 'x' static
doesntWork.cpp:9: error: ISO C++ forbids in-class initialization of non-const static member 'x'
You are not allowed to initialize x in the class definition. To initialize x, you either need a function to set the value of x (often referred to as a "setter") or a constructor which sets x to a value.
For setters, see the first example of the CRectangle class, the function you're interested in is called set_values (adjust it accordingly to fit your code).
For constructors, see the section on constructors and destructors.
Change "return 0;" to "return 1". Return 0 won't return a value.
That makes no sense, return 0; returns 0, return 1; returns 1. See, they both return a value.
The return call you refer to returns a value to the OS (see link below) and is used to indicate successful termination of the program. It is also the return from the main function and is completely irrelevant to the OP's question.
Change "return 0;" to "return 1". Return 0 won't return a value.
return 0 is the correct way to end your main() program function. It's the same as saying return EXIT_SUCCESS which is the proper, portable way for your program to communicate exit status to the OS. return 1 indicates your program failed in some way and the OS should inform the user.