a class-key must be used when declaring a friend的问题

今天在游戏引擎的时候遇见了这样一个问题就是

在dev c++下

编写如下代码:

private: //about thread. void UseThread(); void CannelThread(); //about folder. void FindPath(const string &path, const string &suffix, bool subpath, list<string> &files); //about audio in dll void FindDll(const string &dll, const string &suffix, list<string> &files); private: ONLY_ONE(AudioManager); //friend class boost::scoped_ptr<AudioManager>; //friend class g::design_pattern::Singleton<AudioManager>; bool EraseInValidFile(); private: ALCdevice *device; ALCcontext *context;

 

其中 ONLY_ONE的内容是

 

#define ONLY_ONE(type) / friend boost::scoped_ptr<type>;/ class g::design_pattern::Singleton<type>; 

 

会出现一个 a class-ey muse be used when declaring a friend 的错误

最后发现只要在 friend后面加一个class 就好了

看来还是经验不错啊

 

具体就是会这样

#define ONLY_ONE(type) / friend class boost::scoped_ptr<type>;/ friend class g::design_pattern::Singleton<type>;

你可能感兴趣的:(String,Class,dll,Path,引擎,audio)