Hi, I am trying to initialize a struct, but I get the following error:
Error #29: Expected an expression
typedef struct { atp V1; atp V2; atp V3; atp V4; } tosh_at; tosh_at tosh_options ={ .V1 = 12, .V3 = 5, };
Can someone please help me. Thanks in advance.
This is C99 syntax. IIRC, the default compiler mode is C90. Try adding --c99 to the compiler command line options.
www.keil.com/.../armccref_cihihhgf.htm
"Try adding --c99 to the compiler command line options"
In the GUI, you can use the Misc Controls box on the Compiler options tab:
http://www.keil.com/support/man/docs/uv4/uv4_dg_adscc.htm
--c99 works! Thanks for the help =)
It is always important to have a running knowledge about the C language standard, since not all (especially embedded) compilers complies with the most recent standard. It's just a too small market to invest all the time for larger compiler rewrites.
That is also one of the reasons why many embedded compilers defaults to older language standards even when a newer standard is supported.
I wonder how long it will take for C11 to become widespread... It does promise some nice features.