derivations

M

Michael Sgier

Hello
because i've a load texture function in md2.cpp i THINK to
need to call the CMD2Model::Load in the md2.cpp
So i fire up enemies in this class:

in ogro.h:
class COgroEnemy : public CEnemy // CEnemy is derived from CEntity and
CEntity from Class CMD2Model
{
public:
COgroEnemy() { Load(); }

then in ogro.cpp:
void COgroEnemy::Load()
{
// load model
CMD2Model::Load("Models/Ogro/Tris.MD2", "Models/Ogro/Ogrobase.bmp");
}

error: no matching function for call to `COgroEnemy::Load()'
error: candidates are: int CMD2Model::Load(char*, char*)

that's in md2.h:
int Load(char *modelFile, char *skinFile);

What is my mistake here? The same works under Windows but i can't figure
out any differences with my Linux version above.
THANKS and regards
Michael
 
A

AnonMail2005

in ogro.h:
class COgroEnemy : public CEnemy // CEnemy is derived from CEntity and
CEntity from Class CMD2Model
{
public:
COgroEnemy() { Load(); }

then in ogro.cpp:
void COgroEnemy::Load()
{
// load model
CMD2Model::Load("Models/Ogro/Tris.MD2", "Models/Ogro/Ogrobase.bmp");
}

error: no matching function for call to `COgroEnemy::Load()'
error: candidates are: int CMD2Model::Load(char*, char*)

I don't see any declaration of COgroEnemy::Load() in the class
declaration.
 
V

Victor Bazarov

Michael said:
because i've a load texture function in md2.cpp i THINK to
need to call the CMD2Model::Load in the md2.cpp
So i fire up enemies in this class:

in ogro.h:
class COgroEnemy : public CEnemy // CEnemy is derived from CEntity and
CEntity from Class CMD2Model
{
public:
COgroEnemy() { Load(); }

then in ogro.cpp:
void COgroEnemy::Load()
{
// load model
CMD2Model::Load("Models/Ogro/Tris.MD2", "Models/Ogro/Ogrobase.bmp");
}

Make sure that the declaration of 'COgroEnemy::Load()' is in the class
'COgroEnemy' _before_ the first use, IOW, before the constructor.
error: no matching function for call to `COgroEnemy::Load()'
error: candidates are: int CMD2Model::Load(char*, char*)

that's in md2.h:
int Load(char *modelFile, char *skinFile);

Change to

int Load(char const* modelFile, char const* skinFile);

(and in the implementation too).
What is my mistake here? The same works under Windows but i can't figure
out any differences with my Linux version above.

V
 
M

mlimber

Michael said:
Hello
because i've a load texture function in md2.cpp i THINK to
need to call the CMD2Model::Load in the md2.cpp
So i fire up enemies in this class:

in ogro.h:
class COgroEnemy : public CEnemy // CEnemy is derived from CEntity and
CEntity from Class CMD2Model
{
public:
COgroEnemy() { Load(); }

You call Load() here with no parameters. Apparently CMD2Model::Load()
takes two parameters of type char* (though it should probably be const
char* or const std::string&) and there is no COgroEnemy::Load()
function with no parameters declared in the class COgroEnemy. If that's
not it, post a more complete piece of code that demonstrates the
problem.
then in ogro.cpp:
void COgroEnemy::Load()
{
// load model
CMD2Model::Load("Models/Ogro/Tris.MD2", "Models/Ogro/Ogrobase.bmp");
}

error: no matching function for call to `COgroEnemy::Load()'
error: candidates are: int CMD2Model::Load(char*, char*)

that's in md2.h:
int Load(char *modelFile, char *skinFile);

What is my mistake here? The same works under Windows but i can't figure
out any differences with my Linux version above.

I doubt the identical code works on Windows. Methinks something is
different between the two.
THANKS and regards
Michael

Cheers! --M
 
T

Thomas J. Gritzan

Michael said:
Hello
because i've a load texture function in md2.cpp i THINK to
need to call the CMD2Model::Load in the md2.cpp
So i fire up enemies in this class:

in ogro.h:
class COgroEnemy : public CEnemy // CEnemy is derived from CEntity and
CEntity from Class CMD2Model
{
public:
COgroEnemy() { Load(); }

I looked into my crystal ball and read tea leaves, found that you have
this here in ogro.h:

int Load(char*, char*);

Changes this to void Load();

Well, I THINK you should read a good book about C++ before trying to
understand such a complex programm.

Thomas
 
J

John Harrison

Thomas said:
I looked into my crystal ball and read tea leaves, found that you have
this here in ogro.h:

int Load(char*, char*);

Changes this to void Load();

Well, I THINK you should read a good book about C++ before trying to
understand such a complex programm.

Thomas

Asumming this is the error then I think the OP should also read the
answers already pointed out to him. I pointed out earlier the
inconsistency in the number of arguments to Load.

To The OP, when you use a function you have to *declare*, *define* and
*call* the function with the same number of arguments (default argument
values aside).

john
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top