How to Fix error: ‘for’ loop initial declarations are only allowed in C99 mode

During the makefile execution today, the following error occurred:

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

note: use option -std=c99 or -std=gnu99 to compile your code

The reason for this is that GCC is based on the C89 standard at compile time, and the C89 standard does not support circular statements defined as follows:

 for(int i=0; i<width; i++)

I in a loop statement is not supported to be defined in a loop statement, so change it to:

 int i;
for(i=0; i<width; i++);

Reexecution will not error ~

Read More: