I tried to get a makefile to compile a file that requires -std=c99 to -std=c99 . In this case, to get an end-to-end loop.
This is my code (it was used "tab" before "$ (CC)"):
CC = gcc CFLAGS = -c -std=c99 ... Download.o : Download.c $(CC) $(CFLAGS) Download.c
Download.c contains methods used to download items from the Internet.
Error message
$ make gcc -c -std=c99 Download.c gcc Download.c -o Program Download.c: In function 'downloadImageparts': Download.c:11:2: error: 'for' loop initial declarations are only allowed in C99 mode Download.c:11:2: note: use option -std=c99 or -std=gnu99 to compile your code Download.c:13:3: error: 'for' loop initial declarations are only allowed in C99 mode make: *** [comp] Error 1
Attemt for debugging
If I run gcc -c -std=c99 Download.c in the terminal, it works fine.
These problems occur when running on Linux.
SOLVE:
I created a dummy project to show my lecturer, trying to solve my problem. In a fictitious project, everything works fine with the described code. For some reason, my code works in place, but not in another. If someone is reading this with the same problem as me, and would like to see an example project. let me know and i will write the code here. Thanks
source share