troubles with implicit declaration static (compiling customized mupdf library)
I am compiling mupdf with a custom version of some functions in mupdf library. There are two functi开发者_运维问答ons that seem to call each other so when I create the _custom
version of them an error is issued at compile time.
pc@pc:~/sviluppo/mupdf-0.9$ make
CC build/debug/obj_print.o
fitz/obj_print.c: In function ‘fmt_array_custom’:
fitz/obj_print.c:191:4: warning: implicit declaration of function ‘fmt_obj_custom’
fitz/obj_print.c: At top level:
fitz/obj_print.c:304:13: warning: conflicting types for ‘fmt_obj_custom’
fitz/obj_print.c:304:13: error: static declaration of ‘fmt_obj_custom’ follows non-static declaration
fitz/obj_print.c:191:4: note: previous implicit declaration of ‘fmt_obj_custom’ was here
make: *** [build/debug/obj_print.o] Errore 1
What's wrong? the default version of the functions already call each other the same way.
In line 191, the function fmt_array_custom
is called without prior declaration. So the compiler implicitly assumes a declaration (non-static
).
Later in line 304, it sees the actual function declaration/definition which is static
. This is a conflict.
For fixing this you can add a declaration before line 191. Just copy the function proto-type (without the body) from line 304.
精彩评论