Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > undefined reference

Reply
Thread Tools

undefined reference

 
 
Michael Sgier
Guest
Posts: n/a
 
      11-03-2005
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
--
Log on at www.mame.dk for MAME Arkade Game Roms
:wq

 
Reply With Quote
 
 
 
 
Tim Love
Guest
Posts: n/a
 
      11-03-2005
Michael Sgier <(E-Mail Removed)> writes:

> myModel-->Unload();

Or myModel->Unload();
?
 
Reply With Quote
 
 
 
 
Karl Heinz Buchegger
Guest
Posts: n/a
 
      11-03-2005
Michael Sgier wrote:
>
> 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 -->


--
Karl Heinz Buchegger
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
Zara
Guest
Posts: n/a
 
      11-03-2005
On Thu, 03 Nov 2005 10:20:24 +0100, Michael Sgier <(E-Mail Removed)>
wrote:

>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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
typeof x == 'undefined' or x == undefined? -Lost Javascript 13 01-31-2007 12:04 AM
undefined vs. undefined (was: new Array() vs []) VK Javascript 45 09-12-2006 05:26 PM
'Undefined' Client-Side Object Reference Felipe ASP .Net 3 07-16-2004 04:01 AM
undefined behavior or not undefined behavior? That is the question Mantorok Redgormor C Programming 70 02-17-2004 02:46 PM
Error: 'undefined reference' in g++ but gcc succeeded Lu C++ 1 07-10-2003 12:55 PM



Advertisments