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 9013355
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:14:40+00:00 2026-06-16T03:14:40+00:00

I have a C++ class and I keep getting this error although I have

  • 0

I have a C++ class and I keep getting this error although I have another class written with similar syntax that compiles without a fuss.

Here is my .h:

#ifndef FISHPLAYER_H
#define FISHPLAYER_H

#include "Player.h"


class FishPlayer : public Player
{
public:
    float xThrust;
    float yThrust;
    static FishPlayer* getInstance();
protected:
private:
    FishPlayer();
    ~FishPlayer();
    static FishPlayer* instance;
};

#endif

And Here is my .cpp :

#include "..\include\FishPlayer.h"

FishPlayer* FishPlayer::instance=0;  // <== I Get The Error Here

FishPlayer::FishPlayer()
{
    //ctor
    xThrust = 15.0f;
    yThrust = 6.0f;
}

FishPlayer::~FishPlayer()
{
    //dtor
}


FishPlayer* FishPlayer::getInstance() { // <== I Get The Error Here
    if(!instance) {
        instance = new FishPlayer();
    }
    return instance;
}

I’ve been searching for a while now and it must be something so big I don’t see it.

Here is the inheritance:

#ifndef PLAYER_H
#define PLAYER_H
#include "Ennemy.h"

class Player : public Ennemy
{
    public:
    protected:
        Player();
        ~Player();
    private:
};

#endif // PLAYER_H

And the higher one:

#ifndef ENNEMY_H
#define ENNEMY_H

#include "Doodad.h"

class Ennemy : public Doodad
{
    public:
        float speedX;
        float maxSpeedX;
        float speedY;
        float maxSpeedY;
        float accelerationX;
        float accelerationY;
        Ennemy();
        ~Ennemy();
    protected:
    private:
};

And the superclass

#include <vector>
#include <string>


enum DoodadType{FishPlayer,Player,AstroPlayer,Ennemy,DoodadT = 999};
enum DoodadRange{Close, Medium , Far};
enum EvolutionStage{Tiny, Small, Average, Large};

class Doodad
{
    public:
        float score;
        void die();
        EvolutionStage evolutionStage;
        DoodadRange range;
        Doodad();
        virtual ~Doodad();
        Doodad(Doodad const& source);
        std::vector<Animation> animations;
        double posX;
        double posY;
        std::string name;
        std::string currentAnimation;
        int currentFrame;
        DoodadType type();
        SDL_Surface getSpriteSheet();
        bool moving;
        void update();
    protected:
    private:
        SDL_Surface spriteSheet;
};
  • 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-16T03:14:42+00:00Added an answer on June 16, 2026 at 3:14 am

    Looks like you use FishPlayer as a enum value in Doodad.h

    It is the same name as the class you’re trying to declare. That might be the source of the problem.

    Generally it’s a good idea to use FISH_PLAYER, or Type_FishPlayer sort of naming scheme for enum values to avoid clashes like this.

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

Sidebar

Related Questions

I have a class that I've written a TypeConverter for. I want to keep
So I keep getting this error that when I Google for it, the most
I keep getting this error - error C2819: type 'List' does not have an
I keep getting this error in my user class: User is not abstract and
I have this code to deserialize this json but i keep getting this error:
I keep getting this error: Catchable fatal error: Object of class DateTime could not
I keep getting this error saying Syntax error on token }, delete this token.
I have a rails application and i keep getting this error /srv/projects/app/controllers/application_controller.rb:174: invalid multibyte
For some reason, I keep getting this error. Couldn't find Album without an ID
I have a view controller class that has to implement several protocols. Too keep

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.