编译器重复定义错误: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;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM