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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:53:37+00:00 2026-05-18T01:53:37+00:00

Consider: #ifndef __t__ENTITY_H #define __t__ENTITY_H #include ../graphics/animation.h namespace t { namespace entity { namespace

  • 0

Consider:

#ifndef __t__ENTITY_H
#define __t__ENTITY_H

#include "../graphics/animation.h"

namespace t {
    namespace entity {
        namespace type {
            enum Enum { GFX = 0, SFX, PFX, AI, MAX };
        }

        //template <class T>
        class Entity {
            public:
                Entity(unsigned int, unsigned int, unsigned int);
                Entity();
                ~Entity();

                int getPosX() { return m_posX; }
                int getPosY() { return m_posY; }
                void setPos(int x, int y) { m_posX = x; m_posY = y; }
                //TODO: const references
                unsigned int getGFXId() { return m_ids[type::GFX]; }
                unsigned int getSFXId() { return m_ids[type::SFX]; }
                unsigned int getPFXId() { return m_ids[type::PFX]; }
                int update(const float);
                int draw();
                int fetchGraphics();
                int fetchSound();
                int fetchPhysics();

            protected:
                //TODO: friend class entity::Handler int reset()
            private:
                int updatePhysics(const float);
                int updateGraphics(const float);
                int updateSound(const float);

                int m_posX, m_posY;
                t::graphics::Animation* m_pAnimation;
                float m_lastTime;
                unsigned int m_ids[type::MAX];
        }; // class Entity
        typedef boost::shared_ptr<t::entity::Entity> SPENTITY;
        typedef boost::shared_ptr<std::vector<SPENTITY> > SPENTITYS;

    } // namespace entity
} // namespace t

#endif // __t__ENTITY_H

In that code the member “t::graphics::Animation* m_pAnimation;” gives “error: ‘t::graphics’ has not been declared”, even though “../graphics/animation.h” looks like:

#ifndef __t__ANIMATION_H
#define __t__ANIMATION_H

#include "frame.h"
namespace t {
    namespace graphics {
        class Animation {
            public:
                Animation();
                Animation(SPFRAMES);

                ~Animation();

                float getLastFrameChange() { return m_lastFrameChange; }
                int getCurrentFrameId() { return m_currentFrameId; }
                //SPFRAME getCurrentFrame() { return m_spFrames.get()[m_currentFrameId]; }//return m_spFrames[m_currentFrameId]; }
                void setCurrentFrame(int val) { m_currentFrameId = val; }

                int update(const float);
                //int fetchDrawables();
            protected:
            private:
                float m_lastFrameChange;
                unsigned int m_currentFrameId;
                unsigned int m_oldFrameId;
                SPFRAMES m_spFrames;
        }; // class Animation
        typedef boost::shared_ptr<Animation> SPANIMATION;
        typedef boost::shared_ptr<std::vector<SPANIMATION> > SPANIMATIONS;
    } // namespace graphics
} // namespace t

#endif // __t__ANIMATION_H
  • 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-05-18T01:53:37+00:00Added an answer on May 18, 2026 at 1:53 am

    You should try to avoid making headers include other headers unless they are necessary. In this case you can put in a forward declaration in the first header.

    namespace t {
       namespace graphics {
           class Animation;
       }
    
       // continue with definitions
    }
    

    There is a possibility that your headers are being included somewhere in the wrong order. Maybe something Animation is including needs that enum so is including your Entity header.

    I would suggest moving that enum to another header. If it is local to the class put it in the class scope.

    As an aside I would also:

    • Move those shared_ptr typedefs to a different header that has just forward declarations. Anyone wanting to use those typedef’s would then not necessarily need to include the full definition of the class, particulary where they are used in a header file.

    • Make your code const-correct.

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

Sidebar

Related Questions

Consider the following Enum and a corrsponding nullable field of that type enum PossibleOptions
Consider this code : HTML: <table> <tr> <td>Option 1</td> <td><input type='checkbox' id='option1' /></td> </tr>
Consider this unhygienic Scheme macro: (define-macro for (lambda (i i1 i2 . body) (let
Consider the following setup: A windows PC with a LAN interface and a WiFi
Consider the need to develop a lightweight desktop DB application on the Microsoft platforms.
Consider: List<String> someList = new ArrayList<>(); // add "monkey", "donkey", "skeleton key" to someList
Consider this problem: I have a program which should fetch (let's say) 100 records
Consider these two function definitions: void foo() { } void foo(void) { } Is
Consider the Oracle emp table. I'd like to get the employees with the top
Consider an indexed MySQL table with 7 columns, being constantly queried and written to.

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.