|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Problem with struct and Cosmic compilerHello,
I am using cosmic Compiler. I have this struct: typedef struct { unsigned int IDAC; unsigned int CANidar0; unsigned int CANidmr0; unsigned int CANidar1; unsigned int CANidmr1; unsigned int CANidar2; unsigned int CANidmr2; unsigned int CANidar3; unsigned int CANidmr3; unsigned int CANidar4; unsigned int CANidmr4; unsigned int CANidar5; unsigned int CANidmr5; unsigned int CANidar6; unsigned int CANidmr6; unsigned int CANidar7; unsigned int CANidmr7; }FILTER; Now I wnt to fill the struct like this: FILTER stConfig; stConfig= { 0x00, 0xFF, // Filter 0 0x00, 0xFF, // Filter 0 0x00, 0xFF, // Filter 1 0x00, 0xFF, // Filter 1 0x00, 0xFF, // Filter 2 0x00, 0xFF, // Filter 2 0x00, 0xFF, // Filter 3 0x00, 0xFF // Filter 3 }; This does not work. I get the error "missing expression" in line "stConfig=" Could anybody tell me, what I am doing wrong? Best regards |
|
|
RE : Problem with struct and Cosmic compilerThe initialization must be part of the declaration, so simply write:
FILTER stConfig = { 0x00, 0xFF, ... Best Regards, Jean-Pierre Lavandier -----Message d'origine----- De : 68HC12@... [mailto:68HC12@...] De la part de folgli@... Envoyé : mercredi 11 mars 2009 13:48 À : 68hc12@... Objet : [68HC12] Problem with struct and Cosmic compiler Hello, I am using cosmic Compiler. I have this struct: typedef struct { unsigned int IDAC; unsigned int CANidar0; unsigned int CANidmr0; unsigned int CANidar1; unsigned int CANidmr1; unsigned int CANidar2; unsigned int CANidmr2; unsigned int CANidar3; unsigned int CANidmr3; unsigned int CANidar4; unsigned int CANidmr4; unsigned int CANidar5; unsigned int CANidmr5; unsigned int CANidar6; unsigned int CANidmr6; unsigned int CANidar7; unsigned int CANidmr7; }FILTER; Now I wnt to fill the struct like this: FILTER stConfig; stConfig= { 0x00, 0xFF, // Filter 0 0x00, 0xFF, // Filter 0 0x00, 0xFF, // Filter 1 0x00, 0xFF, // Filter 1 0x00, 0xFF, // Filter 2 0x00, 0xFF, // Filter 2 0x00, 0xFF, // Filter 3 0x00, 0xFF // Filter 3 }; This does not work. I get the error "missing expression" in line "stConfig=" Could anybody tell me, what I am doing wrong? Best regards [Non-text portions of this message have been removed] |
|
|
Re: Problem with struct and Cosmic compilerThe type holds 17 ints. Your instantiation has only 16.
-rob folgli@... wrote: > > Hello, > > I am using cosmic Compiler. > I have this struct: > > typedef struct > { > unsigned int IDAC; > unsigned int CANidar0; > unsigned int CANidmr0; > unsigned int CANidar1; > unsigned int CANidmr1; > unsigned int CANidar2; > unsigned int CANidmr2; > unsigned int CANidar3; > unsigned int CANidmr3; > unsigned int CANidar4; > unsigned int CANidmr4; > unsigned int CANidar5; > unsigned int CANidmr5; > unsigned int CANidar6; > unsigned int CANidmr6; > unsigned int CANidar7; > unsigned int CANidmr7; > }FILTER; > > Now I wnt to fill the struct like this: > FILTER stConfig; > stConfig= > { > 0x00, 0xFF, // Filter 0 > 0x00, 0xFF, // Filter 0 > 0x00, 0xFF, // Filter 1 > 0x00, 0xFF, // Filter 1 > 0x00, 0xFF, // Filter 2 > 0x00, 0xFF, // Filter 2 > 0x00, 0xFF, // Filter 3 > 0x00, 0xFF // Filter 3 > > }; > > This does not work. I get the error "missing expression" in line > "stConfig=" > > Could anybody tell me, what I am doing wrong? > > Best regards > > |
|
|
|
| Free embeddable forum powered by Nabble | Forum Help |