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
 
K

Karl Heinz Buchegger

Michael 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();

You probably just confused your compiler.
That should read:

myModel->Unload();

The operator is -> not -->
 
Z

Zara

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();


I suppose you mean 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

You have declared but not defined Unload.
You need something like

int CMD2Model::Unload()
{
// do whatever is fit
}

-- Zara
 

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

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top