respeaker / mic_array_dfu

ReSpeaker Microphone Array DFU tool for firmware upgrade
19 stars 22 forks source link

add C99 support for gcc #2

Closed wzpan closed 7 years ago

wzpan commented 7 years ago

I came across such error when trying to make:

gcc -g  src/xmosdfu.c -o dfu `pkg-config --cflags --libs libusb-1.0`
src/xmosdfu.c: In function ‘find_xmos_device’:
src/xmosdfu.c:70:13: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
             for(int j = 0; j < sizeof(pidList)/sizeof(unsigned short); j++)
             ^
src/xmosdfu.c:70:13: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
src/xmosdfu.c:94:25: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
                         for (int j = 0; j < config_desc->bNumInterfaces; j++)
                         ^
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1

Then I found out that I have to add -std=c99 flag to make gcc building with C99 standard.

xiongyihui commented 7 years ago

Thanks.