Error C3861 issues

Hi guys,

I'm relatively new to C++ and I'm in the process of putting together a physics engine for one of my courses at school.

I'm having problems with the C3861 issue "C3861: 'start_Particle': identifier not found

ParticleModel.H:
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
#include "dataTypes.h"
#include <math.h>
#include <stdlib.h>
#include <iostream>

class ParticleModel
{
private:
	// Dynamics parameters (for physics simulation) 
	Point2D 	pos;				// position of particle used as physics model of game object

public:
	ParticleModel(float xPos, float yPos);
	~ParticleModel(void);

	//Projectiles for the bullets fired from the tank.
	void init_Projectiles(void);
	void move_Projectiles(void);
	void draw_Projectiles(void);
	void fire_Projectiles(int angle, float vel);
	
	//Particles for the explosions and other effects.
	void reset_Particles(void);
	void draw_Particles(void);
	void move_Particles(void);
	void start_Particle(int type, int count, int x, int y, int xv, int yv);	//This is the constructor for the particles
	void start_Particles_Explosion(int type, int count, int x, int y, int xv, int yv, int num_particles);	//This is the constructor for the explosion
	void start_Particle_Ring(int type, int count, int x, int y, int xv, int yv, int num_particles);

	//Definitions
	#define max_Particles  256
	#define PARTICLE_STATE_DEAD  0
	#define PARTICLE_STATE_ALIVE 1
	#define PARTICLE_TYPE_FADE  1
	#define RAND_RANGE(x,y) ((x) +(rand()%((y)-(x)+1)))

	int index;	//Used in the for loop

	PARTICLE particles [256];	//Particles used for the engine

	/* Set / get attributes of game object */
	void setPosition(float xCoord, float yCoord);   // Set world position of game object

	Point2D getPosition();							// Get position of game object
};


ParticleModel.cpp
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#include "ParticleModel.h"
#include "lookupTable.h"

ParticleModel::ParticleModel(float xPos, float yPos)
{
	pos.x = xPos;
	pos.y = yPos;
}

ParticleModel::~ParticleModel(void)
{
}

		/*----------------------------------------------------------------------------\
		 *                                                                            |
		 *                  STATE ACCESS (get / set) FUNCTIONS                        |
		 *                                                                            |
		 *----------------------------------------------------------------------------*/
 
/*
 * Sets position of particle.
 *
 * Parameter list
 *        xPos		x-coordinate of position.
 *        yPos		y-coordinate of position.
 */
void ParticleModel::setPosition(float xPos, float yPos)
{
     // position of particle
    pos.x = xPos; pos.y = yPos;
}
    
/* TODO: Add functions to set other particle model parameters, e.g. velocity, acceleration, ... */

   
/*
 * Gets position of particle.
 *
 * Parameter list
 *        none.
 */
Point2D ParticleModel::getPosition()
{
	return pos;
}


//New pieces of information from 13.10

void ParticleModel::reset_Particles(void)
{
	//This initialises and resets the particles within the model
	//Loop through all current particles and set their state to dead
	for (int index = 0; index < max_Particles; index++)
	{
		particles[index].state = PARTICLE_STATE_DEAD;
		particles[index].type = PARTICLE_TYPE_FADE;
		particles[index].x = 0;
		particles[index].y = 0;
		particles[index].xv = 0;
		particles[index].yv = 0;
		particles[index].counter = 0;
		particles[index].max_count = 0;
	}
}	//End reset_Particles

void ParticleModel::start_Particle(int type, int count, int x, int y, int xv, int yv)
{
	//This initialises a single particle.

	int pindex = -1; //Local declaration of pindex for use in this method only

	//Check to see if any particles are alive
	//If so, set to dead

	for (int index = 0; index < max_Particles; index++)
	if (particles[index].state == PARTICLE_STATE_DEAD)
	{
		//Setting the local index
		pindex = index;
		break;
	}

	if (pindex ==-1)
		return;

	//Setting the general information relating to a particle
	particles[index].state = PARTICLE_STATE_ALIVE;
	particles[index].type = type;
	particles[index].x = x;
	particles[index].y = y;
	particles[index].xv = xv;
	particles[index].yv = yv;
	particles[index].counter = 0;
	particles[index].max_count = count;
}//End start_Particle

void ParticleModel::start_Particles_Explosion(int type, int count, int x, int y, int xv, int yv, int num_particles)
{
	//This function will start a particle explosion at a given position and velocity
	while(--num_particles >= 0)
	{
		//Calculating a random position in a 360 radius to fire the particle
		int ang = rand()%360;

		//Calculating a random velocity for each particle
		float vel = 2+rand()%4;

		start_Particle(type, count, x+RAND_RANGE(-4,4),y+RAND_RANGE(-4,4),xv+cos_look[ang]*vel, yv+sin_look[ang]*vel);
	}
}//End start_Particle_Explosion

void start_Particle_Ring(int type, int count, int x, int y, int xv, int yv, int num_particles)
{
	//This function starts a particle explision at a given position and velocity
	//Uses the new lookup tables
	
	//Calculate random trajectory angle
	float vel = 2+rand()%4;

	while(--num_particles >=0)
	{
		int ang = rand()%360;

		start_Particle(type, count, x, y, xv+cos_look[ang]*vel, yv+sin_look[ang]*vel);
	}
}//end start_Particle_Ring

void ParticleModel::draw_Particles(void)
{
	for (int index = 0; index < max_Particles; index++)
	{
		//Test to see if particle is alive
		if (particles[index].state = PARTICLE_STATE_ALIVE)
			int x = particles[index].x;
			int y = particles[index].y;

			//Collision detection removed as it is elsewhere in the software.
	}
}


The problem occurs in the start_Particle_Ring method, line 125 in the .cpp file. I've highlighted it in bold also.

Any help to solve this would be greatly appreciated. Ben

EDit: IDE used: Visual Studio 2008
Last edited on
I've just realised the mistake that I have made. I forgot to add the ParticleModel:: before start_Particle_Ring.

With this change in mind, I'm now coming up with the C2011 error with the ParticleModel.h class being redefined.

Nothing more than adding ParticleModel:: has been changed. Any ideas?
Your header file should have "include guards" to prevent multiple inclusion:
1
2
3
4
5
6
#ifndef HEADER_FILE_NAME_H
#define HEADER_FILE_NAME_H

// header file content goes here

#endif 

This prevents the header file being included multiple times accidentally. If, for example, your "particlemodel.h" header were also included in "lookuptable.h" then a multiple inclusion of "particlemodel.h" in "particlemodel.cpp" would be prevented.

Hope this helps.
It has. Thanks for the quick response, Xander.
Topic archived. No new replies allowed.