Skip to main content
SScot.3
Associate III
July 29, 2021
Question

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....

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.

This topic has been closed for replies.

3 replies

Tesla DeLorean
Guru
July 29, 2021

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
TDK
July 29, 2021

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
SScot.3Author
Associate III
July 29, 2021

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!