编译器重复定义错误:error C2371: 'SIZE' : redefinition; different basic types

我们常常会定义自己工程用的数据类型,可能会与Windows的基本数据类型冲突。

vs会报重复定义错误:error C2371: 'SIZE' : redefinition; different basic types

 

解决方法:欺骗编译器

#define SIZE wSIZE
typedef long SIZE;
#undef SIZE
typedef int SIZE;
 
int _tmain(int argc, _TCHAR* argv[])
{
	SIZE n = 0;		//SIZE = int
	wSIZE wN = 0;	//wSIZE = long
 
	return 0;
}
posted @ 2016-03-31 11:09  iluzhiyong  阅读(3767)  评论(0编辑  收藏  举报