所以这显然不是真正的错误,但我不知道实际错误是什么,因为症状是如此模糊。我只是在这里包含文件,你们告诉我你认为它可能导致未声明的标识符错误的地点和位置。
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未声明是否有任何问题?这是输出中唯一的错误。认为你需要更多文件,我会包括它们。
答案 0 :(得分:1)
这通常是由包含头文件的循环引起的。在您的情况下,EntityBase.h
或EntityList.h
似乎包含System.h
。解决此问题的最简单方法是从#include "EntityManager.h"
中移除System.h
并在class EntityManager;
中转发声明system.h
。请注意,您需要在#include "EntityManager.h"
中执行system.cpp
。