As the question says, what exactly are the consequences of having an “implicit function declaration”? We just backed up the warning flags on gcc and found quite a few examples of these warnings, and I'm curious what problems may arise before they are fixed?
Also, why is this a warning and not an error. How can gcc even successfully link this executable? As you can see in the example below, the executable works as expected.
Take the following two files, for example:
file1.c
#include <stdio.h>
int main(void)
{
funcA();
return 0;
}
file2.c
#include <stdio.h>
void funcA(void)
{
puts("hello world");
}
Compilation and output
$ gcc -Wall -Wextra -c file1.c file2.c
file1.c: In function 'main':
file1.c:3: warning: implicit declaration of function 'funcA'
$ gcc -Wall -Wextra file1.o file2.o -o test.exe
$ ./test.exe
hello world
source
share