C语言 我得到了函数 strncmp 的隐式声明

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7579370/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 09:44:14  来源:igfitidea点击:

I get implicit declaration of function strncmp

c

提问by jingo

I get "implicit declaration of function 'strncmp' isinvalid in C99" when use strncmp (xcode 4/ gcc version 4.2.1) How to avoid this ?

使用 strncmp (xcode 4/ gcc version 4.2.1) 时,我得到“C99 中函数‘strncmp’的隐式声明无效”如何避免?

回答by Ignacio Vazquez-Abrams

From the strncmp(3)man page:

strncmp(3)手册页:

      #include <string.h>
      #include <string.h>

回答by user541686

Did you forget to #include <string.h>?

你忘记了#include <string.h>吗?