I am still having some issues with this whole class thing in Visual C++ 6.0. Based on the code I am pasting below, is it best to create the app as a Win 32 Console App or just a Win 32 App? Also, I must be doing something wrong because the nature of the error messages I am getting lead me to believe that I am sourcing in my class (for lack of a better term) correctly. Any help that anyone could provide would be awesome... I'll paste the code and errors.
Main source code:
Code:
#include <iostream>
#include <string>
#include "square.h"
#include "ezwin.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;
}
square.h (header file/class):
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
Here are the errors, I created this app as a plain old Win 32 Application (totally blank):
test0422.cpp
C:\Program Files\Microsoft Visual Studio\MyProjects\pleasework\test0422.cpp(12) : error C2065: 'Square' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\pleasework\test0422.cpp(12) : error C2146: syntax error : missing ';' before identifier 'GreenSquare'
C:\Program Files\Microsoft Visual Studio\MyProjects\pleasework\test0422.cpp(12) : error C2065: 'GreenSquare' : undeclared identifier
C:\Program Files\Microsoft Visual Studio\MyProjects\pleasework\test0422.cpp(13) : error C2228: left of '.SetColor' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\MyProjects\pleasework\test0422.cpp(14) : error C2228: left of '.SetPosition' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\MyProjects\pleasework\test0422.cpp(15) : error C2228: left of '.SetSize' must have class/struct/union type
C:\Program Files\Microsoft Visual Studio\MyProjects\pleasework\test0422.cpp(17) : error C2228: left of '.Draw' must have class/struct/union type
Error executing cl.exe.
pleasework.exe - 7 error(s), 0 warning(s)
Thanks!