I am trying to do a program where it draws a green square within a SimpleWindow. The square has to have 1.5 cm sides and be centered 3.5 cm from the left edge and 2.5 from the top edge of the window. I am required to do this with a square.h class that I have included with this post.. I am getting the following message when attempting to compile it (with VC++ 6.0):
c:\program files\microsoft visual studio\myprojects\ex_712a\ex_712a.cpp(27) : fatal error C1010: unexpected end of file while looking for precompiled header directive
Error executing cl.exe.
ex_712a.exe - 1 error(s), 0 warning(s)
Here is the code for my main source and my square class..
main source:
Square.h (class):Code:#include <iostream> #include "square.h" using namespace std; int ApiMain() { SimpleWindow Test; Test.Open(); Square GreenSquare(Test); GreenSquare.SetColor(Green); GreenSquare.SetPosition(3.5,2.5); GreenSquare.SetSize(1.5); GreenSquare.Draw(); cout << "Type a character followed by a\n" << "return to remove the display and exit" << endl; char AnyChar; cin >> AnyChar; Test.Close(); return 0; }
I did also have the following enum in the square.h, but the compiler was complaining about it, so I thought that it might not be necessary..Code:#ifndef SQUARE_H #define SQUARE_H #include "ezwin.h" class Square { public: Square(SimpleWindow &W); void Draw(); void SetColor(const color &Color); void SetPosition(float XCoord, float YCoord); void SetSize(float Length); private: color Color; float XCenter; float YCenter; float SideLength; SimpleWindow &Window; }; #endif
enum color {Red, Green, Blue, Yellow, Cyan, Magenta};
Any help or pointers that someone may have would be great. Thanks!!



LinkBack URL
About LinkBacks


