c2061 error help

Running through a tutorial of sorts and got an error. I have looked through a few forums and tried what was suggested to no avail. I am using Visual Studio 2010 on Vista.

the error is c2061: syntax error: identifier 'CSprite'

here is some of the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
bool Game::run(void)
{
	drawArea.createSprite(0, 'H');

	player = new CSprite(&drawArea, 0);

	char key = ' ';

	startTime = timeGetTime();
	frameCount = 0;
	lastTime = 0;

	while (key != 'q')
	{
		while (!getInput(&key))
		{
			timerUpdate();
		}
	}

	delete player;

	cout << frameCount / ((timeGetTime() - startTime) / 1000) << " fps" << endl;

	return true;
}

#ifndef GAME_H
#define GAME_H

#include "DrawEngine.h"
#include "sprite.h"

#include <new>
using namespace std;

class Game
{
public:
	bool run(void);

protected:
	bool getInput(char *c);
	void timerUpdate(void);

private:
	sprite *player;
	double frameCount;
	double startTime;
	double lastTime;

	DrawEngine drawArea;
};

#endif

class sprite
{
public:
	void cSprite(DrawEngine *de, int index, float x = 1, float y = 1,int lives = 1);
	void DSprite();

	vector getPosition(void);
	float getX(void);
	float getY(void);

	virtual void addLives(int num = 1);
	int getLives(void);
	bool isAlive(void);

	virtual bool move(float x, float y);

protected:
	DrawEngine *drawArea;
	vector pos;
	int spriteIndex;
	int numLives;

	int classID;
		
	vector facingDirection;
	
	void draw(float x, float y);
	void erase(float x, float y);

};


The issue seems to be with the line "player = new CSprite($drawArea, 0);"

Last edited on
When asking a question, please do the following:

1) Use code tags (put your code inside of [.code] and [./code] Without the dots)
2) Indent your code
Last edited on
bool Game::run(void)
the void is only needed in c and i am fairly certain it is a depreciated value in c++ but regardless is not required.
Topic archived. No new replies allowed.