What more could you want?
Posts tagged gcc
warning: incompatible implicit declaration of built-in function ‘strlen’
Mar 2nd
This is an error presented by the GNU Compiler Collection (which I still like to call the GNU C Compiler) when compiling a piece of code that calls to a function in the <string.h> header file if it cannot find the function.
Typically, this is caused by a call to the strlen function when the <string.h> header has not been included.
$ grep ‘#include’ whiteout.c
#include <stdio.h>
$ gcc -o ../whiteout whiteout.c
whiteout.c: In function ‘trim’:
whiteout.c:49: warning: incompatible implicit declaration of built-in function ‘strlen’
whiteout.c: In function ‘add’:
whiteout.c:64: warning: incompatible implicit declaration of built-in function ‘strlen’$ grep ‘#include’ whiteout.c
#include <stdio.h>
#include <string.h>
$ gcc -o ../whiteout whiteout.c
$
As you can see, simply placing the statement ‘#include <string.h>’ into your includes section of your code will alleviate the issue.
/cs