I'm porting code from an 8051 to ARM. I have a string that shows Model, Version, Compile Date & Time:
#define ModelName "H" #define FW_Version "1.04" ... const char ModuleInfo[] = {"M2P " ModelName " v" FW_Version " " __DATE__ " @ " __TIME__}; ... printf("%s\r\n", ModuleInfo);
This would print: "M2P H v1.04 May 08 2007 @ 14:57:00". The ARM compiler now gives me error #67: expected a "}" for the const line. If the Date & Time macros are no longer valid, that's fine, but what else changed to prevent the rest from working? Or was C51 just more lenient? I added commas between all the fields and that didn't help. Thanks.
Should compile ok unless you have managed to add some invalid character somewhere.
You can not use any comma since you do not initialize an array of arrays of characters or array of character pointers. The compiler will glue together all string sections.
Note that there is no need for the {} around the initialization.
Ok, it works now. Thanks.