gcc: Compilation Warning: incompatible implicit declaration of built-in function `bzero’
2011-08-23 11:19
696 查看
http://joysofprogramming.com/gcc-incompatible-implicit-declaration-bzero/
这个警告加上#include <strings.h>就可以了。
The purpose of bzero() as described by the man page
Let’s make use of bzero in a simple program
Now compile the
program bzero.c…
You will see the following warnings.
This is because we missed to add the headers which declare the function bzero() and the supporting types
Let’s add the relevant header files (.h) and compile the program
Compile..
Now you will find that the program is successfully compiled and linked.
这个警告加上#include <strings.h>就可以了。
The purpose of bzero() as described by the man page
bzero - write zero-valued bytes
Let’s make use of bzero in a simple program
int main(int argc, char*argv[]){ void *s; size_t n; bzero(s,n); return 0; }
Now compile the
program bzero.c…
$ gcc bzero.c
You will see the following warnings.
bzero.c: In function âmainâ: bzero.c:4: error: âsize_tâ undeclared (first use in this function) bzero.c:4: error: (Each undeclared identifier is reported only once bzero.c:4: error: for each function it appears in.) bzero.c:4: error: expected â;â before ânâ bzero.c:5: warning: incompatible implicit declaration of built-in function âbzeroâ bzero.c:5: error: ânâ undeclared (first use in this function)
This is because we missed to add the headers which declare the function bzero() and the supporting types
Let’s add the relevant header files (.h) and compile the program
#include <strings.h>
int main(int argc, char*argv[]){ void *s; size_t n; bzero(s,n); return 0; }
Compile..
$ gcc bzero.c
Now you will find that the program is successfully compiled and linked.
相关文章推荐
- 解决warning: incompatible implicit declaration of built-in function 'malloc'
- warning: incompatible implicit declaration of built-in function ‘exit’
- convert.c:7:3: warning: incompatible implicit declaration of built-in function ‘printf’ [enabled by
- warning: incompatible implicit declaration of built-in function ‘strlen’
- JNI--warning: incompatible implicit declaration of built-in function 'memcpy'
- warning: incompatible implicit declaration of built-in function ‘exit’
- warning: incompatible implicit declaration of built-in function ***
- warning: incompatible implicit declaration of built-in function ‘xyz’
- incompatible implicit declaration of built-in function 'exit'
- incompatible implicit declaration of built-in function ‘strlen’
- warning: incompatible implicit declaration of built-in function ‘strcpy’
- 【C】编译提示 warning: incompatible implicit declaration of built-in function ‘calloc’ [enabled by default]
- warning: incompatible implicit declaration of built-in function sqrt [enabled by default]
- warining:incompatible implicit declaration of built-in function 警告的解决方法
- warning: incompatible implicit declaration of built-in function 'exit'
- 解决warning: incompatible implicit declaration of built-in function 'malloc'
- C语言编译出现 incompatible implicit declaration of built-in function ‘strlen’等
- incompatible implicit declaration of built-in function ‘xyz’
- warning: incompatible implicit declaration of built-in function ‘strlen’
- warning : incompatible implicit declaration of built-in function 'exit' [enabled by default]