Plzhelp
Junior Member level 3
Dear All,
I have coded a small structure and initialized it. I am getting some error while compiling this code. How can I resolve this problem?? I will be grateful for your help.
C code:
struct ver_id
{
U32 address;
U32 mode_val;
U32 rst_val;
U32 majVer : 12;
struct regDef majVer_rD;
U32 minVer : 20;
struct regDef minVer_rD ;
};
struct ver_id initval = {initval.address = 0x0, initval.rst_val = 0x00100000, initval.majVer = 1, initval.majVer_rD.maskVal=0xFFF00000,
initval.majVer_rD.mode=READ , initval.minVer = 0,initval.minVer_rD.maskVal=0x000FFFFF,initval.minVer_rD.mode=READ };
Error flashed by Visual Studio compiler:
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(30): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(30): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(30): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(30): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(31): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(31): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(31): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(31): error C2099: initializer is not a constant
Thanks in advance.
I have coded a small structure and initialized it. I am getting some error while compiling this code. How can I resolve this problem?? I will be grateful for your help.
C code:
struct ver_id
{
U32 address;
U32 mode_val;
U32 rst_val;
U32 majVer : 12;
struct regDef majVer_rD;
U32 minVer : 20;
struct regDef minVer_rD ;
};
struct ver_id initval = {initval.address = 0x0, initval.rst_val = 0x00100000, initval.majVer = 1, initval.majVer_rD.maskVal=0xFFF00000,
initval.majVer_rD.mode=READ , initval.minVer = 0,initval.minVer_rD.maskVal=0x000FFFFF,initval.minVer_rD.mode=READ };
Error flashed by Visual Studio compiler:
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(30): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(30): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(30): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(30): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(31): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(31): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(31): error C2099: initializer is not a constant
1>c:\users\anmukher\documents\visual studio 2010\projects\structures\structures\ppcs_pma_reg.c(31): error C2099: initializer is not a constant
Thanks in advance.