Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

n00b error

I would try and fix this, im even trying to, but my tierdness is overwelming.
ok, im getting these errors:
c:\documents and settings\pro.com\my documents\visual studio 2005\projects\cargame\cargame\car.cpp(37) : error C2511: 'Car::Car(OgreNewt::World *,Ogre::SceneNode *,Ogre::SceneManager *,Ogre::String,const OgreNewt::MaterialID *)' : overloaded member function not found in 'Car'
from this code:
#include "car.h"

Car::MyTire::MyTire(Ogre::SceneManager* mgr, Ogre::SceneNode* parentnode, OgreNewt::Vehicle* vehicle, Ogre::Quaternion localorient, Ogre::Vector3 localpos, Ogre::Vector3 pin,
Ogre::Real mass, Ogre::Real width, Ogre::Real radius, Ogre::Real susShock, Ogre::Real susSpring, Ogre::Real susLength, int colID)
: Tire( vehicle, localorient, localpos, pin, mass, width, radius, susShock, susSpring, susLength, colID )
{
mSceneMgr = mgr;

Ogre::SceneNode* node = parentnode->createChildSceneNode();
attachToNode( node );
node->setScale( Ogre::Vector3( radius, radius, width ) );

mRadius = radius;

//mRecObj = NULL;
}

Car::MyTire::~MyTire()
{
// delete the visual object for this tire.
while (getOgreNode()->numAttachedObjects() > 0)
{
Ogre::MovableObject* ent = getOgreNode()->detachObject(static_cast<unsigned short>(0));
mSceneMgr->destroyEntity( (Ogre::Entity*)ent );
}
getOgreNode()->getParentSceneNode()->removeAndDestroyChild( getOgreNode()->getName() );

}

Car::Car() : OgreNewt::Vehicle()
{
}

Car::Car( OgreNewt::World* world, Ogre::SceneNode* parentnode, Ogre::SceneManager* mgr, Ogre::String filename, const OgreNewt::MaterialID* mat ) : OgreNewt::Vehicle(), mSceneMgr(mgr)
{
_init( world, parentnode, mgr, filename, mat );
}

Car::~Car()
{
std::vector<Car::MyTire*> tires;

// delete tire entities.
for (Car::MyTire* tire = (Car::MyTire*)getFirstTire(); tire; tire = (Car::MyTire*)getNextTire( tire ) )
{
tires.push_back( tire );
}

for (int i=0; i<tires.size(); i++)
{
Car::MyTire* tire = tires[i];
delete tire;
}

// delete the scene node.
while (m_chassis->getOgreNode()->numAttachedObjects() > 0)
{
Ogre::MovableObject* obj = m_chassis->getOgreNode()->detachObject(static_cast<unsigned short>(0));
mSceneMgr->destroyEntity( (Ogre::Entity*)obj );
}

Ogre::SceneNode* todestroy = (Ogre::SceneNode*)m_chassis->getOgreNode()->getParent()->removeChild( m_chassis->getOgreNode()->getName() );
mSceneMgr->SceneManager::destroySceneNode( todestroy->getName() );

destroy();
}; can somebody plase tell me how to fix this.
Car.h:#pragma once
#include "OgreNewt.h"

class Car :
public OgreNewt::Vehicle
{
public:
enum VehicleState
{
VS_4ONFLOOR, VS_2WHEELS, VS_AIRBORNE, VS_UPSIDEDOWN
};
Car(void);

class MyTire : public OgreNewt::Vehicle::Tire
{
public:
MyTire( Ogre::SceneManager* mgr, Ogre::SceneNode* parentnode, OgreNewt::Vehicle* vehicle, Ogre::Quaternion localorient, Ogre::Vector3 localpos, Ogre::Vector3 pin,
Ogre::Real mass, Ogre::Real width, Ogre::Real radius, Ogre::Real susShock, Ogre::Real susSpring, Ogre::Real susLength, int colID = 0);

~MyTire();


void setSteer( int steer ) { mSteer = steer; }
int getSteer() { return mSteer; }

void setDrive( int drive ) { mDrive = drive; }
int getDrive() { return mDrive; }

void setGrip( Ogre::Real grip ) { mGrip = grip; }
Ogre::Real getGrip() { return mGrip; }

private:

Ogre::SceneManager* mSceneMgr;
int mSteer;
int mDrive;
Ogre::Real mGrip;
Ogre::Real mRadius;
};

struct TorquePoint
{
Ogre::Real rpm;
Ogre::Real torque;
};

~Car(void);
};
[4173 byte] By [dan_haribo] at [2007-11-11 8:45:43]
# 1 Re: n00b error
That error means you have the wrong parameters for your function, so the compiler is assuming that a version with that alternate parameter list is out there, and it didnt find it. You need to double check your function parameters & make sure the class has a function header for that function.
jonnin at 2007-11-11 21:01:06 >
# 2 Re: n00b error
Here, it looks like the constructor, and the only constructor you have is car() but you called one with car(stuff, morestuff, evenmorestuff, somethingelse)
jonnin at 2007-11-11 21:02:06 >
# 3 Re: n00b error
Passing such a huge number of arguments to a function is a bad idea. Make sure that your constructors take up to 3 parameters. Otherwise it's really hard to keep track of what's going on.
The error you got indicates that you called the constructor with incorrect arguments: their order, their types or their number were wrong. Which is why you want to stick to a small number of parameters.
Danny at 2007-11-11 21:03:09 >
# 4 Re: n00b error
well i din't make this code, walaber( www.walaber.com ) did. it compiled for him.
ah well, im not so tierd now, il try thinking about it
dan_haribo at 2007-11-11 21:04:10 >