2011-05-10 144 views
0

我聲明瞭一個類是這樣的:問題聲明類和命名空間

#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); 
     }; 
    }; 
}; 

但我得到一個編譯錯誤CLuaHelper不ZEL :: utils的成員。 CLuaHelper被聲明爲utils :: CLuaHelper(沒有zel)我該如何聲明這個類。 AFAIK,前向聲明可能會解決這個問題

任何想法??

+2

try':: utils :: CLuaHelper * m_luaHelper;'** :: utils **我相信會從全局範圍開始查找,而** utils :: **將從本地範圍開始查找 – Mayank 2011-05-10 12:11:41

回答

5

使用::utils::CLuaHelper來區分兩個utils名稱空間。

+0

這是正是我需要的。謝謝! – Killrazor 2011-05-10 13:24:01