请在这里给我一个提示:
class UIClass
{
public:
UIClass::UIClass();
};
#ifndef __PLATFORM__
#define __PLATFORM__
UIClass Platform;
#else
extern UIClass Platform;
#endif
我包括这两次并得到:
LNK2005 - 平台已在 .obj (MSVS13) 中定义。
您可以猜到,这个想法是只定义一次平台。为什么会#ifndef
或#define
失败?我应该如何解决这个问题?