c++ - error c2056: undeclared identifier -
so isn't real error, have no idea actual error because symptom vague. i'll include files here , guys tell me , think might causing 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 framework elements. #include "i_os.h" #include "i_graphics.h" //the derived interface elements tailored platform. #include "windows_module.h" #include "d3d11_module.h" #include "entitymanager.h" // ** author note ** temporary until ini file reading implemented #define full_screen false /******************************************************************************* purpose: central object responsible containing , systematically initializing, updating per frame, , shutting down objects responsible various internal workings of framework. serve nexus external entities retrieve data, interface engine elements, interfacing between eachother. ********************************************************************************/ class system { public: /* framework elements , interfaces contain initialization context created outside, filled out, , passed initalize function. 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 each framework element std::shared_ptr<i_os> m_os; std::shared_ptr<i_graphics> m_graphics; std::shared_ptr<entitymanager> m_entitymanager; }; /* global pointer entities use access public interface pointers entire framework. ** author note ** : entities should refer interfaces, , non platform specific elements maintain crossplatform compatibility, (if can 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: wil object responsible managing , updating various entities rendered in scene. reads scene file , dynamically creates instances of objects listed stored in vector. these objects can accessed individually either index or unique string identifier, or can obtain vector contains objects of 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 there wrong these causing entitymanager undeclared? it's error in output. think need anymore files , i'll include them.
this caused circular inclusion of header files. in case, looks either entitybase.h
or entitylist.h
includes system.h
. simplest way solve remove #include "entitymanager.h"
system.h
, forward declaring class entitymanager;
in system.h
. note need #include "entitymanager.h"
in system.cpp
.
Comments
Post a Comment