undefined reference

M

Michael Sgier

Hi
I get the error:

`Unload' undeclared (first use this function)

but I did in main.cpp:

CMD2Model *myModel = new CMD2Model;

here ( also in main.cpp) I get the above error:

void CleanUp()
{
myModel-->Unload();
delete myModel;

// free(groundTexture);
}

and have also included a header file with the class:

class CMD2Model
{
....

public:

CMD2Model(); // constructor
~CMD2Model(); // destructor

....

// free memory of model
int Unload();
....

Uhmmm whereis the mistake :) Thanks and regards
Michael
 
M

Marcelo Slomp

Michael Sgier said:
Hi
I get the error:

`Unload' undeclared (first use this function)

but I did in main.cpp:

CMD2Model *myModel = new CMD2Model;

here ( also in main.cpp) I get the above error:

void CleanUp()
{
myModel-->Unload();
delete myModel;

// free(groundTexture);
}

and have also included a header file with the class:

class CMD2Model
{
...

public:

CMD2Model(); // constructor
~CMD2Model(); // destructor

...

// free memory of model
int Unload();
...

Uhmmm whereis the mistake :) Thanks and regards
Michael

use -> when refering to a member of a class/struct/union pointer:
myModel->Unload();
instead
myModel-->Unload();
 
M

Michael Sgier

Nope nothing changed, still the same error:

[Linker error] undefined reference to `CMD2Model::Unload()'

Michael
 
R

red floyd

Michael said:
Nope nothing changed, still the same error:

[Linker error] undefined reference to `CMD2Model::Unload()'

Michael
You've declared it. Did you ever write the implmentation of
CMD2Model::Unload()? If so, did you specify the object file/library
that it resides in as part of your link?

I believe this is a FAQ (don't remember which one).
 

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

Similar Threads

undefined reference 3
derivations 5
Constructor 4
1. Porting win to lin 2
undefined reference(compile error), plz help 4
undefined reference to vtable 2
reference 1
'Undefined' error 5

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top