【发布时间】:2012-12-09 13:55:10
【问题描述】:
假设代码:
extern int foo(void);
static int foo(void)
{
return 0;
}
尝试用 GCC 编译
$ gcc -Wall -std=c99 1.c
1.c:3:12: error: static declaration of ‘foo’ follows non-static declaration
1.c:1:12: note: previous declaration of ‘foo’ was here
1.c:3:12: warning: ‘foo’ defined but not used [-Wunused-function]
那么,我该如何声明静态函数呢?
【问题讨论】:
-
"那么,如何声明静态函数?"
static int foo(void);