hello! i m using stm32lo73rz in keil micro vresion 5 in hll format. I cant initialize char and int. I m using unsigned char i[]= "giga" but warning will generate that i not decleared. and when compile the programe in docklight giga will not print correctly any other word will come there at rx side when tx something according to code.this is my email abhij752@gmail.com please help me out from this.
Hello Abhi,
I assume you are using this part: www.st.com/.../stm32l073rz.html
And you are using the ARMCC compiler version 5
It sounds like you are used to programming using the C99 programming standard - that is not the default setting in the Keil tools, C90 is.
Project » Options for Target » Compiler on the "C/C++" tab, check "C99 mode"
See: http://www.keil.com/support/man/docs/uv4/uv4_dg_adscc.htm
Otherwise in C90, you must first define your variables then use them.
Here are some of the features the ARMCC compiler supports in the C99 standard.
www.keil.com/.../armcc_chr1359124237277.htm
This is true, but
unsigned char i[]= "giga";
is valid as a definition.
But C90 requires that all definitions must appear before any executable code in a block.
See, for example: stackoverflow.com/.../iso-c90-forbids-mixed-declarations-and-code-in-c
This is why we need to see an example of how that statement is actually being used in context!
Andrew,
Correct. I was making an assumption based on the error message, since it looks like well formed code.
Well, we're all just guessing until the OP comes back and presents a proper example.
I wonder if that will ever happen - or (s)he is just sitting there waiting for replies to her/his email ... ?
Hey Andrew,
Nah, this is probably one of those "post it out of desperation but as soon as you click post, you realized the mistake, but you forgot to tell the rest of us" kind of posts.
I posted a guess to try to avoid this scenario:
https://xkcd.com/979/
View all questions in Keil forum