1

我正在使用 mupdf 库中某些函数的自定义版本编译 mupdf。有两个函数似乎相互调用,所以当我创建_custom它们的版本时,会在编译时发出错误。

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

怎么了?函数的默认版本已经以相同的方式相互调用。

4

1 回答 1

1

在第 191 行,函数fmt_array_custom在没有事先声明的情况下被调用。所以编译器隐含地假设一个声明(非static)。

稍后在第 304 行,它看到了实际的函数声明/定义,即static. 这是一个冲突。

为了解决这个问题,您可以在第 191 行之前添加一个声明。只需从第 304 行复制函数原型(没有主体)。

于 2011-09-21T10:32:36.463 回答