如何删除VS警告C4091:'typedef':当没有声明变量时,忽略'SPREADSHEET'左侧的 [英] How can I remove the VS warning C4091: 'typedef ' : ignored on left of 'SPREADSHEET' when no variable is declared
本文介绍了如何删除VS警告C4091:'typedef':当没有声明变量时,忽略'SPREADSHEET'左侧的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此警告在我的代码中通过同一声明多次触发,其内容如下:
This warning is triggered multiple times in my code by the same declaration, which reads :
// Spreadsheet structure
typedef struct SPREADSHEET
{
int ID; // ID of the spreadsheet
UINT nLines; // Number of lines
void CopyFrom(const SPREADSHEET* src)
{
ID = src->ID;
nLines = src->nLines;
}
};
我不想只是关闭该警告,
I don't want to just turn off that warning,
但是改变代码,使警告不会出现!
but rather change the code so that the warning doesn't come up !
注意:我不想在这里声明任何变量一个头文件),只定义结构'SPREADSHEET'应该包括...
NOTE : I don't want to declare any variables here (it's a header file), only define what the struct 'SPREADSHEET' should include...
推荐答案
删除 typedef
。它是C语言的结构体,C ++会自动为你。
Delete typedef
. It's the C way of declaring structs, C++ does it automatically for you.
这篇关于如何删除VS警告C4091:'typedef':当没有声明变量时,忽略'SPREADSHEET'左侧的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文