warning: incompatible implicit declaration of built-in function ‘xyz’

       今天写一个程序的时候出现了如下错误:

        written_amount.c: In function ‘do_one_group’:

written_amount.c:33:3: warning: incompatible implicit declaration of built-in function ‘strcat’
written_amount.c:41:3: warning: incompatible implicit declaration of built-in function ‘strcat’
written_amount.c:45:3: warning: incompatible implicit declaration of built-in function ‘strcat’
written_amount.c: In function ‘written_amount’:

written_amount.c:55:3: warning: incompatible implicit declaration of built-in function ‘strcpy’


自己由于大意没发现原因,搜了下原来是缺少了头文件。先把搜的结果如下:

In C, using a previously undeclared function constitutes an implicit declaration of the function. In an implicit declaration, the return type is int if I recall correctly. Now, GCC has built-in definitions for some standard functions. If an implicit declaration does not match the built-in definition, you get this warning.

To fix the problem, you have to declare the functions before using them; normally you do this by including the appropriate header. I recommend not to use the -fno-builtin-* flags if possible.





你可能感兴趣的:(warning: incompatible implicit declaration of built-in function ‘xyz’)