   Custom return types
  Hi everyone,I have yet again another inane question.  I sem to be having a problem in my classes if I try and use a return type of one of my own objects. when I try and compile it I get errors from the compiler that basically make it sound like the compiler doesn''t understand what that object is. I had the same problem with my particle engine earlier but I just worked around it. But just searched the forums and found a post of soemone doing the same kind of thing. But I don''t see how they are doing it any different from me. Here is the header for my enemy class and one of the function calls that are causing a problemenemy.h   #pragma once#include "stdafx.h"#include "particle.h"#include "wayPoint.h"class enemy : public particle{public:bool isAsleep, boss;int  waitSleep, waitWake, aiType;string name;enemy(double x, double y, int aiType);enemy(double x,double y, int life, int velocity, int theta, int aiType);enemy(double x,double y, int life, int velocity, int theta, int aiType, string eName, bool isBoss);~enemy(void);int getWeapon(void);void setWeapon(int weaponType);void respawn(int x, int y);void tick( int decrement);void wake(void);void wake(int time);void sleep(void);void sleep(int time);void addWayPoint(double x, double y, double w, double h, int moveType, int velocity);wayPoint getWayPoint(void);void seekWayPoint(void);void flush(void);private: int currentWeapon, currentWayPoint;vector<wayPoint> wpList;};Here is the implementation of the get wayPoint function.wayPoint enemy::getWayPoint(){return this->wpList[this->currentWayPoint];}  If anyone can help me  with why the wouldn''t work I would be forever in your debt. Thanks in advance -Andy   "And then 2 men appeared... Men in dark suits.. with dark soulless eyes. Men like this could have come from only one place.. The bank."
  What is the problem you get? ;  sorry about the format I Am on my way to work, but here are the compiler errors wayPoint.cppc:\Documents and Settings\me\My Documents\Visual Studio Projects\Bebop Demo\Bebop\enemy.h(34) : error C2146: syntax error : missing '';'' before identifier ''getWayPoint''c:\Documents and Settings\me\My Documents\Visual Studio Projects\Bebop Demo\Bebop\enemy.h(34) : error C2501: ''enemy::wayPoint'' : missing storage-class or type specifiersc:\Documents and Settings\me\My Documents\Visual Studio Projects\Bebop Demo\Bebop\enemy.h(34) : warning C4183: ''getWayPoint'': missing return type; assumed to be a member function returning ''int''c:\Documents and Settings\me\My Documents\Visual Studio Projects\Bebop Demo\Bebop\enemy.h(42) : error C2065: ''wayPoint'' : undeclared identifierc:\Documents and Settings\me\My Documents\Visual Studio Projects\Bebop Demo\Bebop\enemy.h(42) : error C2955: ''std::vector'' : use of class template requires template argument list   c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\vector(655) : see declaration of ''std::vector''enemy.cppc:\Documents and Settings\me\My Documents\Visual Studio Projects\Bebop Demo\Bebop\enemyManager.h(28) : error C2146: syntax error : missing '';'' before identifier ''getEnemy''c:\Documents and Settings\me\My Documents\Visual Studio Projects\Bebop Demo\Bebop\enemyManager.h(28) : error C2501: ''enemyManager::enemy'' : missing storage-class or type specifiersc:\Documents and Settings\me\My Documents\Visual Studio Projects\Bebop Demo\Bebop\enemyManager.h(28) : warning C4183: ''getEnemy'': missing return type; assumed to be a member function returning ''int''c:\Documents and Settings\me\My Documents\Visual Studio Projects\Bebop Demo\Bebop\enemyManager.h(57) : error C2065: ''enemy'' : undeclared identifierc:\Documents and Settings\me\My Documents\Visual Studio Projects\Bebop Demo\Bebop\enemyManager.h(57) : error C2955: ''std::vector'' : use of class template requires template argument list   c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\vector(655) : see declaration of ''std::vector''c:\Documents and Settings\me\My Documents\Visual Studio Projects\Bebop Demo\Bebop\enemy.cpp(116) : warning C4018: ''>='' : signed/unsigned mismatchGenerating Code...;  Hm, it seems that the compiler can''t find the definition of wayPoint.  Check that you''re using the std namespace (since you''re not prefixing std:: in front of your string''s and vector''s), and that you #include <vector> somewhere in your headers. ;  Actaully I am including all of that in the stdafx header here is the header // stdafx.h : include file for standard system include files,// or project specific include files that are used frequently, but// are changed infrequently//#pragma once#define WIN32_LEAN_AND_MEAN// Exclude rarely-used stuff from Windows headers// Windows Header Files:#include <windows.h>// C RunTime Header Files#include <stdlib.h>#include <malloc.h>#include <memory.h>#include <tchar.h>// TODO: reference additional headers your program requires here#include "KWindow.h"#include "KGraphic.h"#include "KInput.h"#include "KMiscTools.h"#include <math.h>#include <vector>#include <string>#include <sstream>//#include "Timer.h"#include "myUtils.h"#include "UIDManager.h"#include "GColor.h"#include "particle.h"#include "particleManager.h"#include "gameImage.h"#include "animationFrame.h"#include "animation.h"#include "animationManager.h"#include "gFXManager.h"#include "player.h"#include "wayPoint.h"#include "enemy.h"#include "enemymanager.h"//#include "keyboard.h"using namespace std;Unless there is a reason that putting that in the stdafx header would be a problem I don''t see why this wouldn''t work.If it makes any difference I am using MS Visual Studio 7   "And then 2 men appeared... Men in dark suits.. with dark soulless eyes. Men like this could have come from only one place.. The bank.";  bump ;  Please post the definition of wayPoint.  That''s likely to be where the problem is at.   ______________________________________________________________The Phoenix shall arise from the ashes...   ThunderHawk -- ¦þMySite______________________________________________________________ ;  Ok, sorry about that, My wayPoint class is still a bit incomplete it is derived from my particle class so I will post both classes.wayPoint .h #pragma once#include "stdafx.h"#include "particle.h"class wayPoint :public particle{public://double x, y, width, height;//int mType, velocity;wayPoint(double x, double y, double w, double h, int moveType, int velocity);~wayPoint(void);};wayPoint.cpp #include "waypoint.h"wayPoint::wayPoint(double x, double y, double w, double h, int moveType, int velocity): particle(x,y){this->x = x;this->y = y;this->width = w;this->height = h;this->mType = moveType;this->velocity = velocity;}wayPoint::~wayPoint(void){}particle.h // particle.h: interface for the particle class.////////////////////////////////////////////////////////////////////////#if !defined(AFX_PARTICLE_H__67B478D7_0E73_4C1B_A249_41AB1A6153DD__INCLUDED_)#define AFX_PARTICLE_H__67B478D7_0E73_4C1B_A249_41AB1A6153DD__INCLUDED_#if _MSC_VER > 1000#pragma once#endif // _MSC_VER > 1000class particle  {private:bool is3d;double alpha;static int j;static const double deg2rad, rad2deg;protected:double RandFloat(void);int angleAdd(int a1, int a2);public://Movement type Enumerationsstatic const int MT_LINEAR;static const int MT_LINEAR_TIME;static const int MT_SINWAVE;static const int MT_POWERCURVE;static const int MT_MOBIUSWAVE;static const int MT_GRAV_PROJECTILE;static const int MT_GRAV_DROP;int life, velocity, theta, phi, mType, type, state, currentImgType, color;long ID;unsigned long oldTime;double x, y, z, width, height, depth, oldX, oldY, x0, y0;particle();particle(double x, double y);//Default 2d Constructorparticle(double x,double y, int life, int velocity, int theta);//2d Constructorparticle(double x, double y, double z);//Default 3d constructorvirtual ~particle();void setSize(double width, double height);void setSize(double width, double height, double depth);void setID(long UID);long getID(void);void age(void);void age(int decrement);void tick(int decrement);void wake(void);void wake(int time);void sleep(void);void sleep(int time);void kill(void);bool isAlive(void);void linearMove(void);void linearMove(int amount);void linearMove(unsigned long tTime);void mobiusWave(void);void mobiusWave(bool positive);void sinWave(void);void sinWave(bool positive);void powerCurve(void);void gravMove(unsigned long tTime);void gravDropMove(unsigned long tTime);void move(void);void move(bool positive);void rotate(int x2, int y2, int angle);void respawn(int x, int y);void respawn(int x, int y, int z);bool collided(particle p);void centerLocation(void);void alignTowards(particle p);void alignTowards(double x, double y);int angleTowards(particle p);int angleTowards(double x, double y);bool withinFOV(int fovAngle, int fovDistance, particle p);};#endif // !defined(AFX_PARTICLE_H__67B478D7_0E73_4C1B_A249_41AB1A6153DD__INCLUDED_)particle .cpp // particle.cpp: implementation of the particle class.////////////////////////////////////////////////////////////////////////#include "stdafx.h"//#include "particle.h"//#include "GColor.h"//#include <math.h>//#include <time.h>//#include <stdlib.h>//////////////////////////////////////////////////////////////////////// Movement Type enumerations//////////////////////////////////////////////////////////////////////const int particle::MT_LINEAR = 0;const int particle::MT_LINEAR_TIME = 1;const int particle::MT_SINWAVE = 2;const int particle::MT_POWERCURVE = 3;const int particle::MT_MOBIUSWAVE = 4;const int particle::MT_GRAV_PROJECTILE = 5;const int particle::MT_GRAV_DROP = 6;// Conversion numbersconst double particle::deg2rad = 3.141592/180;const double particle::rad2deg = 180/3.141592;//////////////////////////////////////////////////////////////////////// Construction/Destruction//////////////////////////////////////////////////////////////////////particle::particle(){this->x = 0;this->y = 0;this->oldX = this->x;this->oldY = this->y;this->x0 = this->x;this->y0 = this->y;//QueryPerformanceCounter((LARGE_INTEGER *) &this->oldTime);this->oldTime = KMiscTools::getMilliseconds();this->life = (int)(this->RandFloat() * 100);this->velocity = (int)(this->RandFloat() * 10)+1;//Note this random angle generation will only produce angles//of a certain set of degrees.this->theta = (int)(this->RandFloat() * 360);this->mType = 0;this->width = 1;this->height = 1;this->type = 0;this->state = 0;this->currentImgType = 0;this->color = GColor::WHITE;}particle::particle(double x, double y){this->x = x;this->y = y;this->oldX = this->x;this->oldY = this->y;this->x0 = this->x;this->y0 = this->y;//QueryPerformanceCounter((LARGE_INTEGER *) &this->oldTime);this->oldTime = KMiscTools::getMilliseconds();this->life = (int)(this->RandFloat() * 100);this->velocity = (int)(this->RandFloat() * 10)+1;//Note this random angle generation will only produce angles//of a certain set of degrees.this->theta = (int)(this->RandFloat() * 360);this->mType = 0;this->width = 1;this->height = 1;this->type = 0;this->state = 0;this->currentImgType = 0;this->color = GColor::WHITE;}particle::particle(double x, double y, int life, int velocity, int theta){this->x = x;this->y = y;this->oldX = this->x;this->oldY = this->y;this->x0 = this->x;this->y0 = this->y;//QueryPerformanceCounter((LARGE_INTEGER *) &this->oldTime);this->oldTime = KMiscTools::getMilliseconds();this->life = life;this->velocity = velocity;this->theta = theta;this->mType = 0;this->width = 1;this->height = 1;this->type = 0;this->state = 0;this->currentImgType = 0;this->color = GColor::WHITE;}particle::~particle(){}void particle::setSize(double width, double height){this->width = width;this->height = height;}void particle::setSize(double width, double height, double depth){this->width = width;this->height = height;this->depth = depth;}void particle::setID(long UID){this->ID = UID;}long particle::getID(){return this->ID;}void particle::age(){this->life--;}void particle::age(int decrement){this->life = this->life - decrement;if(this->life < 0){this->life = 0;}}void particle::kill(){this->life = 0;}bool particle::isAlive(){bool alive = false;if(this->life > 0){alive = true;}return alive;} void particle::linearMove(){if(this->is3d){//If the particle is 3d do 3d calculationsthis->alpha = this->velocity * cos(this->phi * deg2rad);this->y -= this->velocity * sin(this->phi * deg2rad);this->x += alpha * sin(this->theta * deg2rad);this->z += alpha * cos(this->theta * deg2rad);}else{//If the particle is 2d do 2d calculationsthis->x += this->velocity * cos(this->theta * deg2rad);this->y -= this->velocity * sin(this->theta * deg2rad);}}void particle::linearMove(int amount){if(this->is3d){//If the particle is 3d do 3d calculationsalpha = this->velocity * cos(this->phi * deg2rad);for(int j=0; j < amount; j++){this->y -= this->velocity * sin(this->phi * deg2rad);this->x += alpha * sin(this->theta * deg2rad);this->z += alpha * cos(this->theta * deg2rad);}}else{//If the particle is 2d do 2d calculationsfor(int j=0; j < amount; j++){this->x += this->velocity * cos(this->theta * deg2rad);this->y -= this->velocity * sin(this->theta * deg2rad);}}}void particle::linearMove(unsigned long tTime){double currentTime, t;//LONGLONG TicksPerSec;//QueryPerformanceFrequency((LARGE_INTEGER *) &TicksPerSec);//t = (double)(1.0/TicksPerSec);t = (double)(1.0/1000);currentTime = (double)((tTime - this->oldTime) * t);//currentTime = (double)((tTime - this->oldTime)/1000);this->oldX = this->x;this->oldY = this->y;this->x = this->x0 +(this->velocity * cos(this->theta * deg2rad) * currentTime);this->y = this->y0 + (this->velocity * sin(this->theta * deg2rad) * currentTime);}void particle::mobiusWave(){this->x++;this->theta++;if(this->theta > 360){this->theta = 0;}this->y += sin(this->theta);}void particle::mobiusWave(bool positive){if(positive){this->x++;}else{this->x--;}this->theta++;if(this->theta > 360){this->theta = 0;}this->y += sin(this->theta);}void particle::sinWave(){this->x += 2;this->y = 2 * sin(this->x)+this->y;}void particle::sinWave(bool positive){if(positive){this->x +=2;}else{this->x -=2;}this->y = 2 * sin(this->x)+this->y;}void particle::powerCurve(){this->y = 3 * sqrt(this->x - this->theta) + this->phi;this->x = this->x+3;}void particle::gravMove(unsigned long tTime){double currentTime;//, t;//LONGLONG TicksPerSec;//QueryPerformanceFrequency((LARGE_INTEGER *) &TicksPerSec);//t = (double)(1.0/TicksPerSec);//currentTime = (double)((tTime - this->oldTime) * t);currentTime = (double)((tTime - this->oldTime)* (1/1000));this->oldX = this->x;this->oldY = this->y;this->x = this->x0 + ((this->velocity * cos(this->theta))* currentTime);this->y = this->y0 + (((this->velocity * sin(this->theta))* currentTime) + (9.81 *(currentTime*currentTime))/2);}void particle::gravDropMove(unsigned long tTime){double currentTime;//, t;//LONGLONG TicksPerSec;//QueryPerformanceFrequency((LARGE_INTEGER *) &TicksPerSec);//t = (double)(1.0/TicksPerSec);//currentTime = (double)((tTime - this->oldTime) * t);currentTime = (double)((tTime - this->oldTime)/1000);this->oldX = this->x;this->oldY = this->y;this->x = this->x0 - (this->velocity * currentTime);this->y = this->y0 + ((9.81 *(currentTime*currentTime))/2);}void particle::move(){//LONGLONG tmpT;//QueryPerformanceCounter((LARGE_INTEGER *) &tmpT);unsigned long tmpT;tmpT = KMiscTools::getMilliseconds();switch(this->mType){case this->MT_LINEAR://This is a linear Movethis->linearMove();break;case this->MT_MOBIUSWAVE://This is a mobius wave paththis->mobiusWave();break;case this->MT_SINWAVE:this->sinWave();break;case this->MT_POWERCURVE:this->powerCurve();break;case this->MT_GRAV_PROJECTILE:this->gravMove(tmpT);break;case this->MT_GRAV_DROP:this->gravDropMove(tmpT);break;case this->MT_LINEAR_TIME:this->linearMove(tmpT);break;default:this->linearMove();}}void particle::move(bool positive){//LONGLONG tmpT=0;//QueryPerformanceCounter((LARGE_INTEGER *) &tmpT);unsigned long tmpT;tmpT = KMiscTools::getMilliseconds();switch(this->mType){case this->MT_LINEAR:this->linearMove();break;case this->MT_MOBIUSWAVE:this->mobiusWave(positive);break;case this->MT_SINWAVE:this->sinWave(positive);break;case this->MT_POWERCURVE:this->powerCurve();break;case this->MT_GRAV_PROJECTILE:this->gravMove(tmpT);break;case this->MT_GRAV_DROP:this->gravDropMove(tmpT);break;case this->MT_LINEAR_TIME:this->linearMove(tmpT);break;default:this->linearMove();}}void particle::rotate(int x2, int y2, int angle){double x1, y1;x1 = ((this->x-x2)* cos(angle * deg2rad) - (this->y-y2)* sin(angle * deg2rad))+x2;y1 = ((this->x-x2)* sin(angle * deg2rad) + (this->y-y2)* cos(angle * deg2rad))+y2;this->x = x1;this->y = y1;}void particle::respawn(int x, int y){this->is3d = false;this->x = x;this->y = y;this->oldX = this->x;this->oldY = this->y;this->x0 = this->x;this->y0 = this->y;this->life = (int)(this->RandFloat() * 100);this->velocity = (int)(this->RandFloat() * 10)+1;//Note this random angle generation will only produce angles//of a certain set of degrees.this->theta = (int)(this->RandFloat() * 360);//Set Activation time//QueryPerformanceCounter((LARGE_INTEGER *) &this->oldTime);this->oldTime = KMiscTools::getMilliseconds();}bool particle::collided(particle p){if(this->y + this->height < p.y){return false;}if(this->y > p.y + p.height){return false;}if(this->x + this->width < p.x){return false;}if(this->x > p.x + p.width){return false;}return true;}void particle::centerLocation(){//Function used for pausingif(this->isAlive()){this->x0 = this->x;this->y0 = this->y;this->oldX = this->x;this->oldY = this->y;//Set Activation time//QueryPerformanceCounter((LARGE_INTEGER *) &this->oldTime);this->oldTime = KMiscTools::getMilliseconds();}}int particle::angleAdd(int a1, int a2){int total = a1+a2;if(total > 360){total = total - 360;}if(total < 0){total = total + 360;}return total;}void particle::alignTowards(particle p){//align towards a particleif(this->x >= p.x){this->theta = this->angleAdd(180, this->angleTowards(p));}else{if(this->y - p.y == 0){this->theta = 0;}else{this->theta = this->angleAdd(0,  -this->angleTowards(p));}}}void particle::alignTowards(double x, double y){//align towards a pointif(this->x >= x){this->theta = this->angleAdd(180,  this->angleTowards(x,y));}else{if(this->y-y == 0){this->theta = 0;}else{this->theta = this->angleAdd(0,  -this->angleTowards(x,y));}}}int particle::angleTowards(particle p){return (int)(this->rad2deg * asin((this->y-p.y)/sqrt(pow((this->x-p.x), 2) + pow((this->y-p.y),2))));}int particle::angleTowards(double x, double y){return (int)(this->rad2deg * asin((this->y-y)/sqrt(pow((this->x-x), 2) + pow((this->y-y),2))));}bool particle::withinFOV(int fovAngle, int fovDistance, particle p){bool isWithin = false;int magnitude;//Find the absolute distance between the 2 particlesmagnitude = sqrt(pow((this->x - p.x), 2) + pow((this->y - p.y),2) );//Only continue if the other particle is even close enough to seeif(magnitude <= fovDistance){int upperView, lowerView, angleT;upperView = this->angleAdd(this->theta , fovAngle/2);lowerView = this->angleAdd(this->theta, -(fovAngle/2));angleT = this->angleAdd(this->theta , this->angleTowards(p));//Determine if the other particle is within this particle''s Field of Viewif(angleT <= upperView && angleT >= lowerView){//The other particle can be seen by this oneisWithin = true;}}return isWithin;}inline double particle::RandFloat(){return (rand())/(RAND_MAX+1.0);};  You''ve got cyclic includes. Enemy.h is including wayPoint.h and wayPoint.h is including Enemy.h. You really shouldn''t have header files that your working on in stdafx.h because it''s ment for headers that don''t change (and it can cause cyclic includes). Just take out all of your headers from stdafx.h and include only the ones you need. ;  Sure thing, will that help with the custom return type problem I am having?