nvim-telescope / telescope-fzf-native.nvim

FZF sorter for telescope written in c
1.36k stars 45 forks source link

Compile error: many features require C99 language standard #34

Closed tymcauley closed 2 years ago

tymcauley commented 2 years ago

After cloning and running make, I get a large number of errors in this vein:

$ make
mkdir -p build
cc -O3 -Wall -Werror -fpic -shared src/fzf.c -o build/libfzf.so
src/fzf.c: In function ‘index_byte’:
src/fzf.c:72:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (size_t i = 0; i < string->size; i++) {
   ^
src/fzf.c:72:3: note: use option -std=c99 or -std=gnu99 to compile your code
src/fzf.c: In function ‘leading_whitespaces’:
src/fzf.c:82:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (size_t i = 0; i < str->size; i++) {
   ^
...

My system has a pretty old gcc version running, so I guess it doesn't use c99 by default:

$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
...

Adding -std=c99 to CFLAGS in the Makefile fixes the build error, I can submit a PR for that shortly.