Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9016589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:02:02+00:00 2026-06-16T04:02:02+00:00

I have problem with exception class… undefined reference to GameProject::GamePlayerNullPointerException::~GamePlayerNullPointerException on line: throw GamePlayerNullPointerException();

  • 0

I have problem with exception class…
“undefined reference to GameProject::GamePlayerNullPointerException::~GamePlayerNullPointerException”

on line: throw GamePlayerNullPointerException();

Game.h

#ifndef GAME_H
#define GAME_H
#include <iostream>
#include "Player.h"
#include "Platform.h"
#include "Item.h"

#include <exception>
#include <stdexcept>
#include <string>

#define string std::string
#define ostream std::ostream
#define istream std::istream

namespace GameProject {

class Game
{
public:
    friend class Inner;
    Game();
    ~Game();
    void startNew();
    void quit();
    void pause();
    void resume();
    void update();
    void moveLeft();
    void moveRight();
    int getScore();
protected:
private:
    class Inner;
    Inner *i;

    Game(const Game& g);
};

class GameException : public std::exception{
    private:
        string error;
    public:
        GameException(const string& message ): error(message){};

        ~GameException()throw ();

        virtual const char* what() throw ();/*const{
            return error.c_str();
            throw ();
        }*/
};

class GameNullPointerException: public GameException{
    public:
        GameNullPointerException(const string & message)
            : GameException(message ) {};
        ~GameNullPointerException() throw ();
};
class GamePlayerNullPointerException: public GameNullPointerException{
    public:
        GamePlayerNullPointerException(const string & message = "Player not exist!")
            : GameNullPointerException( message )
        {}
        ~GamePlayerNullPointerException() throw ();
};
class GamePlatformNullPointerException: public GameNullPointerException{
    public:
        GamePlatformNullPointerException()
            : GameNullPointerException( "Platform not exist!" ){}
        ~GamePlatformNullPointerException() throw ();
};

class GamePlayerWrongPositionException: public GamePlayerNullPointerException{
    public:
        GamePlayerWrongPositionException(): GamePlayerNullPointerException( "Player off screen!!!" ){ }
        ~GamePlayerWrongPositionException() throw ();
};

 }
#undef string
#undef ostream
#undef istream
#endif // GAME_H

Game.cpp

void Game::startNew() {
if(i->pla==NULL)
    throw GamePlayerNullPointerException();
i->pla = new Player(20,20);
i->init();
}

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T04:02:04+00:00Added an answer on June 16, 2026 at 4:02 am
    ~GamePlayerNullPointerException() throw ();
    

    You’ve declared the destructor but not defined it. Either change the declaration to a definition in the .h file:

    ~GamePlayerNullPointerException() throw () { }
    

    Or in the .cpp file add a definition:

    GamePlayerNullPointerException::~GamePlayerNullPointerException() throw ()
    {
    }
    

    Or just get rid of it if it doesn’t do anything. The compiler will generate an empty destructor for you if you don’t provide one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with lazy loading in many-to-many. There is no exception and there
I have a problem in catching an exception. I am trying to rethrow an
I have a problem with auto_ptr in Exception classes, that I eventually reduced to:
I have a problem with writing a catch clause for an exception that is
I have a problem with my Java progam suddenly exiting, without any exception thrown
I have a problem when I try to persist my model. An exception is
when i run my application, i get following exception. I have no problem with
I am facing the following problem : I have a namespace Exception\* , which
i have a problem when i run a page.jsp : Exception while calling encodeEnd
I have problem with this exception: Hibernate.HibernateException : Could not create the driver from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.