标签: c2079

错误C2079,定义类的顺序是什么

我收到此头文件的编译器错误:

#ifndef GAME1_H  
#define GAME1_H  
#include "GLGraphics.h"  
#include "DrawBatch.h"  
class GameComponent;  
class Game1 {  
private:  
    GLGraphics graphics;  
 GameComponent components;
 void updateDelegates();  
 void Run();  
};  

class GameComponent {  
private:  
 static int index;  
protected:  
 Game1 game;  
public:  
 GameComponent();  
 GameComponent(Game1 game);  
 void Update(int);  
 void Dispose();  
};  

class DrawableGameComponent: public GameComponent  
{  
private:  
 GLGraphics graphics;  
 DrawBatch drawBatch;  
public:   
 DrawableGameComponent();  
 DrawableGameComponent(Game1);  
 void Draw();  
};  

#endif
Run Code Online (Sandbox Code Playgroud)

我发现问题是Game1需要GameComponent的完整定义,而GameComponent需要Game1的完整定义.我在单独的标题中有这些太麻烦了,所以这就是他们在一起的原因.如果没有完全改变其中一个类的实现,我有什么方法可以做到这一点?

谢谢!

c++ c2079

4
推荐指数
1
解决办法
4917
查看次数

C++:不能使用std :: wstringstream

出于某种原因,当我尝试创建一个时,我的项目将无法编译wstringstream:

std::wstringstream stringstream;
Run Code Online (Sandbox Code Playgroud)

这会导致错误C2079:

'stringstream'使用未定义的类'std :: basic_stringstream <_Elem,_ Traits,_ Alloc>与[_Elem = wchar_t,_Traits = std :: char_traits,_Alloc = std :: allocator'

我究竟做错了什么?

c++ compiler-errors c2079

2
推荐指数
1
解决办法
5808
查看次数

标签 统计

c++ ×2

c2079 ×2

compiler-errors ×1