Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode #7

Open
MoHorst opened this issue Nov 2, 2018 · 1 comment
Assignees
Labels
question Further information is requested solved Solved issue

Comments

@MoHorst
Copy link

MoHorst commented Nov 2, 2018

Should i add -std=c99?

root@bananapim2zero:~/timonel/timonel-bootloader# make
tml-bootloader.c: In function ‘main’:
tml-bootloader.c:200:25: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (int i = 0; i < PAGE_SIZE - 2; i += 2) {
^
tml-bootloader.c:200:25: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
tml-bootloader.c: In function ‘ReceiveEvent’:
tml-bootloader.c:247:5: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (byte i = 0; i < commandBytes; i++) {
^
tml-bootloader.c: In function ‘RequestEvent’:
tml-bootloader.c:293:13: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (byte i = 0; i < GETTMNLV_RPLYLN; i++) {
^
tml-bootloader.c:347:17: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (byte i = 3; i < (RXDATASIZE + 1); i += 2) {
^
tml-bootloader.c:354:17: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (byte i = 1; i < (RXDATASIZE + 1); i += 2) {
^
tml-bootloader.c:364:13: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
for (byte i = 0; i < WRITPAGE_RPLYLN; i++) {
^
Makefile:55: recipe for target 'tml-bootloader.o' failed
make: *** [tml-bootloader.o] Error 1

@casanovg casanovg self-assigned this Nov 2, 2018
@casanovg casanovg added the question Further information is requested label Nov 2, 2018
@casanovg
Copy link
Owner

casanovg commented Nov 2, 2018

Hi!
It is not necessary, I never had that issue with updated versions of the toolchain. I'm compiling it with avr-gcc v8.2.0 downloaded from Zak Kemble's site.

$ avr-gcc --version

avr-gcc.exe (GCC) 8.2.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

In addition, if you have Git Bash installed, it is better to compile it with this script ./MAKE_TML.sh to get smaller images and being able to locate it in upper memory positions.

Please let me know if this solves the issue, thank you ...

Regards!

@casanovg casanovg added the help wanted Extra attention is needed label Nov 2, 2018
@casanovg casanovg removed the question Further information is requested label May 9, 2020
@casanovg casanovg added question Further information is requested solved Solved issue and removed help wanted Extra attention is needed labels May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested solved Solved issue
Projects
None yet
Development

No branches or pull requests

2 participants