0

これは明らかに実際のエラーではありませんが、症状が非常に曖昧であるため、実際のエラーが何であるかはわかりません。ここにファイルを含めます。宣言されていない識別子エラーの原因と思われる場所と原因を教えてください。

system.h(66): error C2065: 'EntityManager' : undeclared identifier

system.h

/*******************************************************************************
filename: System.h

Author:

Date: November 13, 2010

********************************************************************************/


#ifndef SYSTEM_H
#define SYSTEM_H

#include <string>
#include <memory>

//The interfaces for the framework elements.
#include "I_OS.h"
#include "I_Graphics.h"

//The derived interface elements tailored to the platform.
#include "Windows_module.h"
#include "D3D11_module.h"
#include "EntityManager.h"

// ** AUTHOR NOTE ** temporary until ini file reading is implemented
#define FULL_SCREEN false


/*******************************************************************************
Purpose: 
This will be the central object that is responsible for containing and 
systematically initializing, updating per frame, and shutting down ALL the objects 
responsible for the various internal workings of the framework. This will also 
serve as the nexus for all external entities to retrieve data, interface with engine 
elements, as well as interfacing between eachother.
********************************************************************************/

class System 
{
public:

    /* All framework elements and interfaces contain an Initialization context to be
    created outside, filled out, and passed into the Initalize function. This is to
    maintain polymorphic similar function declarations, while still having variable
    parameters */

    class InitializeContext
    {
    public:
        HINSTANCE hinstance;
    };

    System();
    ~System();

    bool Initialize(InitializeContext &);
    void Run();
    void Shutdown();

public:

    //pointer declarations of interface types for each framework element
    std::shared_ptr<I_OS> m_os;
    std::shared_ptr<I_Graphics> m_graphics;
    std::shared_ptr<EntityManager> m_EntityManager;
};


/* This will be the global pointer that all entities will use to access the
public interface pointers to the entire framework.

** AUTHOR NOTE ** : all entities should refer to the interfaces, and non platform
specific elements to maintain crossplatform compatibility, (if it can be avoided)*/
extern std::shared_ptr<System> g_System;

#endif

EntityManager.h

/*******************************************************************************
filename: EntityManager.h

Author: 

Date: October 27, 2011

********************************************************************************/

#ifndef ENTITY_MANAGER_H
#define ENTITY_MANAGER_H

#include <vector>
#include <map>
#include <fstream>
#include <memory>
#include "EntityBase.h"
#include "EntityList.h"

/*******************************************************************************
Purpose:
This wil be the object responsible for managing and updating all the various Entities
currently rendered in a scene. It reads from a scene file and dynamically creates instances
of the objects listed to be stored in a vector. these objects can be accessed individually
by either index or unique string identifier, or you can obtain a vector that contains
objects of the same class type. 
********************************************************************************/
class EntityManager
{
public:
    bool Initialize();
    bool Frame();
    void Shutdown();

private:
    BaseFactory m_factory;
    std::vector <std::shared_ptr<BaseEntity> > m_EntityList;
    std::map<std::string, std::shared_ptr<BaseEntity> > m_EntityByNameList;
    std::map<std::string, std::vector<std::shared_ptr<BaseEntity> > > m_EntityByClassList;
};

#endif

EntityManager が宣言されていない原因となるこれらの問題はありますか? 出力の唯一のエラーです。もうファイルが必要だと思うので、それらを含めます。

4

1 に答える 1

1

これは通常、ヘッダー ファイルの循環インクルードが原因です。あなたの場合、どちらかのように見えますEntityBase.hor EntityList.hincludes System.h。これを解決する最も簡単な方法は、 での宣言を削除#include "EntityManager.h"して転送することです。で行う必要があることに注意してください。System.hclass EntityManager;system.h#include "EntityManager.h"system.cpp

于 2012-07-03T05:09:11.053 に答える