问题描述
大家好,
i我正在尝试制作一个结构
#include" globalVars.h"
struct myStruct {
int offset;
unsigned char uChars [numOfGlobalVars -1];
} saveVars,getVars;
我在globalVars.h中有#define numOfGlobalVars ...它没有
main.cpp: 23:错误:''struct myStruct''没有名为''uChars''的成员,
当我稍后在我的代码中尝试访问这些uChars时。
我应该不能这样做吗?
nass
它对我有用。告诉我们更多关于您使用的编译器
的版本和内容。
帮派。
它对我有用。告诉我们更多关于你用过的编译器
的版本和内容。
帮派。
Hello everyone,
i am attempting to make a structure
#include "globalVars.h"
struct myStruct{
int offset;
unsigned char uChars[numOfGlobalVars -1];
} saveVars, getVars;
and i have #define numOfGlobalVars in globalVars.h... it does not
compile saying
main.cpp:23: error: ''struct myStruct'' has no member named ''uChars'',
when i try to access these uChars later on in my code.
should i not be able to do that?
nass
It works for me. I suggest you post a minimal but complete example.
It worked for me. Tell us a little more about the compiler you''ve used
the version and stuff.
gangs.
It worked for me. Tell us a little more about the compiler you''ve used
the version and stuff.
gangs.
这篇关于在#define长度的结构中声明一个数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!