cancel
Showing results for 
Search instead for 
Did you mean: 

Hello- New to ST32 and the IDE, and re-learning C as well. I am trying to work an example using I2C for a 2 line by 16 digit LCD. When I compile (build) I get 4 errors, need to help if you would. 1st time poster....

SScot.3
Associate II

error: 'for' loop initial declarations are only allowed in C99 or C11 mode

 223 |  for(uint8_t i=0; i<offset;i++)

 error: 'for' loop initial declarations are only allowed in C99 or C11 mode

 234 |  for(uint8_t i=0; i<offset;i++)

error: 'for' loop initial declarations are only allowed in C99 or C11 mode

 250 |  for(uint8_t i=0; i<strlen(stringArray) && i<16; i++)

Error 1

"make -j8 all" terminated with exit code 2. Build might be incomplete.

I got it to compile yesterday with no errors, just didn't print to the LCD.

These errors happened when I deleted all and started over.

What am I missing?

And, thanks in advance.

3 REPLIES 3

For K&R C you'd need the uint8_t i; outside of the for statement and at the beginning of a compound block, ie immediately after the opening brace {

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TDK
Guru

Go into your project properties and make sure you're compiling with C99 or later. Not sure why yours got changed.

0693W00000D12diQAB.png

If you feel a post has answered your question, please click "Accept as Solution".
SScot.3
Associate II

Thanks TDK, that did the trick. Compiles fine.

Still doesn't print to my LCD yet.

I did do the LED blink thing so I am not a total nube!

Will delete all and will re-create and see what happens.

Thanks for the input!