简体   繁体   English

memcmp的隐式声明在c99中无效

[英]Implicit declaration of memcmp is invalid in c99

I'm creating a very basic C console application in Xcode 4 and I'm hitting a warning on compile: Implicit declaration of memcmp is invalid in c99 . 我在Xcode 4中创建了一个非常基本的C控制台应用程序,我在编译时遇到警告: Implicit declaration of memcmp is invalid in c99

My use of the function is as you would expect: 我对函数的使用正如您所期望的那样:

if(memcmp(buf, block, 0x14) != 0)
{
    fclose(fh);
    printf("invalid file: %s\n", argv[argc-1]);
    return 1;
}

How is the use of the function wrong and how can I go about fixing it? 如何使用该功能错误,我该如何解决?

你忘了#include <string.h> ,它包含memcmp的声明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM