在VC++的工程内添加自定义结构的异常代码 C2011
在VC++的工程内添加自定义结构的错误代码 C2011
我新建了一个VC++的工程,我需要在此工程内添加一些自定义的结构。所以我建立了一个test.h的文件,生成了两个结构,内容如下:
test.h
typedef struct _ab
{
bool aa;
bool bb;
int cc;
}ab;
typedef struct _abcd
{
bool aaaa;
bool bbbb;
int cccc;
}abcd;
然后我在工程内对话框的123dlg.cpp内add member Variable 建立此结构变量m_abcd。并且在123dlg.h内包含#include "test.h "。但是在使用m_abcd的时候出现编译错误error C2011: '_abcd ' : 'struct ' type redefinition
------解决方案--------------------
上面的 _ab ab; 多写了。
我新建了一个VC++的工程,我需要在此工程内添加一些自定义的结构。所以我建立了一个test.h的文件,生成了两个结构,内容如下:
test.h
typedef struct _ab
{
bool aa;
bool bb;
int cc;
}ab;
typedef struct _abcd
{
bool aaaa;
bool bbbb;
int cccc;
}abcd;
然后我在工程内对话框的123dlg.cpp内add member Variable 建立此结构变量m_abcd。并且在123dlg.h内包含#include "test.h "。但是在使用m_abcd的时候出现编译错误error C2011: '_abcd ' : 'struct ' type redefinition
------解决方案--------------------
上面的 _ab ab; 多写了。