I took c++ a long time ago in school, now I am trying to relearn everything again. I think this is a very stupid question but I don't care, here it goes:
----------------------------------------------------------------Code://test.cpp #include "point.h" using namespace std; int main() { Point pt1; pt1.set_x(1234); pt1.print_x(); }
------------------------------------------------------------------Code://point.h #ifndef POINT_H #define POINT_H #include "point.cpp" class Point { public: void set_x( int new_number ); void print_x(); private: int x; }; #endif
Code://point.cpp #include <iostream> void Point::set_x( int new_number) { x = new_number; } void Point::print_x() { cout << "\nThe value for x is : " << x << endl << endl; }
Ok so that is my code, as you can see three (3) different files.
When I try to compile this is what happenes:
bash-3.00$ g++ test.cpp
In file included from point.h:3,
from test.cpp:1:
point.cpp:3: error: syntax error before `::' token
point.cpp:9: error: syntax error before `::' token
bash-3.00$
What am I doing wrong here. I have tried to do it many different ways, but nothing seems to work. Please, help!!
Thanks,
Figa