Warum Deklaration von 'extern' funktioniert nicht mit statischen Funktionen in C?

Angenommen, der code:

extern int foo(void);

static int foo(void)
{
        return 0;
}

Versuchen zu kompilieren mit 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]

So, wie kann ich erklären statische Funktion?

"Also, wie kann ich erklären, statische Funktion?" static int foo(void);

InformationsquelleAutor | 2012-12-09

Schreibe einen Kommentar