undefined reference

Discussion in 'C++' started by Michael Sgier, Aug 21, 2004.

  1. 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
    Michael Sgier, Aug 21, 2004
    #1
    1. Advertising

  2. "Michael Sgier" <> wrote in message
    news:4127bb35$0$11780$...
    > 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();
    Marcelo Slomp, Aug 22, 2004
    #2
    1. Advertising

  3. Nope nothing changed, still the same error:

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

    Michael
    Michael Sgier, Aug 22, 2004
    #3
  4. Michael Sgier

    red floyd Guest

    Michael Sgier wrote:
    > 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).
    red floyd, Aug 22, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Felipe
    Replies:
    3
    Views:
    437
    Felipe
    Jul 16, 2004
  2. Lu
    Replies:
    1
    Views:
    559
    Roel Schroeven
    Jul 10, 2003
  3. Mantorok Redgormor
    Replies:
    70
    Views:
    1,722
    Dan Pop
    Feb 17, 2004
  4. VK
    Replies:
    45
    Views:
    572
    Dr John Stockton
    Sep 12, 2006
  5. -Lost
    Replies:
    13
    Views:
    355
    Richard Cornford
    Jan 31, 2007
Loading...

Share This Page