C++ 声明类和命名空间时出现问题
我声明的类如下:C++ 声明类和命名空间时出现问题,c++,namespaces,C++,Namespaces,我声明的类如下: #include "BindableInterface.h" #include "../LuaHelper.h" #include <map> #include <string> namespace utils{ class CLuaHelper; }; namespace zel{ namespace utils{ class CAPIBindManager { typed
#include "BindableInterface.h"
#include "../LuaHelper.h"
#include <map>
#include <string>
namespace utils{
class CLuaHelper;
};
namespace zel{
namespace utils{
class CAPIBindManager
{
typedef std::map<std::string, CBindeableInterface*> t_exposedClassMap;
t_exposedClassMap m_classesToExpose;
utils::CLuaHelper* m_luaHelper;
public:
bool exportClasses(const unsigned char* data);
bool executeLuaChunk(const std::string fileName, const std::string funtionName);
bool addClassToExpose(CBindeableInterface* bindableInterface, const std::string alias);
CAPIBindManager(void);
~CAPIBindManager(void);
};
};
};
#包括“BindableInterface.h”
#包括“./LuaHelper.h”
#包括
#包括
命名空间utils{
CLuaHelper类;
};
名称空间zel{
命名空间utils{
班主任
{
typedef std::map t_exposedClassMap;
t_exposedClassMap m_classesToExpose;
utils::CLuaHelper*m_luaHelper;
公众:
bool exportClasses(常量无符号字符*数据);
bool executeLuaChunk(const std::string fileName,const std::string funtionName);
bool addClassToExpose(cbindableInterface*bindableInterface,const std::string别名);
CAPIBindManager(无效);
~CAPIBindManager(无效);
};
};
};
但是我得到了一个编译错误,即CLuaHelper不是zel::utils的成员。CLuaHelper被声明为utils::CLuaHelper(没有zel)我需要如何声明这个类。好吧,转发声明可能会解决这个问题
任何想法???使用
::utils::CLuaHelper
来区分这两个utils
名称空间。使用::utils::CLuaHelper
来区分这两个utils
名称空间。尝试::utils::CLuaHelper*m\u luaHelper代码>::我相信utils将从全局范围开始查找,而utils::将从本地范围开始查找try::utils::CLuaHelper*m_luaHelper代码>::我相信utils将从全局范围开始查找,而utils::将从本地范围开始查找。这正是我所需要的。非常感谢。这正是我需要的。非常感谢。