类定义有关问题
类定义问题
//block.h
#include "stdafx.h"
#ifndef AFX_BLOCK
#define AFX_BLOCK
class block
{
public:
block(void);
void SetBlock(U8 style);
protected:
private:
U8 b_style ; //block style
MyPoint b_block[4][4] ; //block
};
#endif
//block.
#include "stdafx.h"//其中stdafx.h中已包含#include"block.h"
//Construction
block::block()
{
//do sth
}
编译时报错:error C2653: 'block' : is not a class or namespace name;
warning C4508: 'block' : function should return a value; 'void' return type assumed;
为什么它没有找到block类(我一开始用这样的方法定义和使用了几个类都没报错)
------解决方案--------------------
//block.h
#include "stdafx.h"
#ifndef AFX_BLOCK
#define AFX_BLOCK
class block
{
public:
block(void);
void SetBlock(U8 style);
protected:
private:
U8 b_style ; //block style
MyPoint b_block[4][4] ; //block
};
#endif
//block.
#include "stdafx.h"//其中stdafx.h中已包含#include"block.h"
//Construction
block::block()
{
//do sth
}
编译时报错:error C2653: 'block' : is not a class or namespace name;
warning C4508: 'block' : function should return a value; 'void' return type assumed;
为什么它没有找到block类(我一开始用这样的方法定义和使用了几个类都没报错)
------解决方案--------------------