Reputation: 3587
so this obviously isn't the real error, but i have no idea what the actual error is because the symptom is so vague. I'll just include the files here and you guys tell me where and what you think it might be causing the undeclared identifier error.
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
So is there anything wrong with these to be causing EntityManager to be undeclared? It's the only error in the output. Think you need anymore files and i'll include them.
Upvotes: 0
Views: 3424
Reputation: 73503
This is normally caused by the circular inclusion of header files. In your case, it looks like either EntityBase.h
or EntityList.h
includes System.h
. The simplest way to solve this is to remove #include "EntityManager.h"
from System.h
and forward declaring class EntityManager;
in system.h
. Note that you need to do #include "EntityManager.h"
in system.cpp
.
Upvotes: 1