Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
memcmp的隐式声明在c99中无效_C_Xcode_C99 - Fatal编程技术网

memcmp的隐式声明在c99中无效

memcmp的隐式声明在c99中无效,c,xcode,c99,C,Xcode,C99,我在Xcode 4中创建了一个非常基本的C控制台应用程序,并且在编译时遇到了一个警告:memcmp的隐式声明在c99中无效 我对该函数的使用与您预期的一样: if(memcmp(buf, block, 0x14) != 0) { fclose(fh); printf("invalid file: %s\n", argv[argc-1]); return 1; } 函数的使用是如何出错的?我如何着手修复它?您忘记了#include,它包含memcmp的声明,在C89/C9

我在Xcode 4中创建了一个非常基本的C控制台应用程序,并且在编译时遇到了一个警告:
memcmp的隐式声明在c99中无效

我对该函数的使用与您预期的一样:

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

函数的使用是如何出错的?我如何着手修复它?

您忘记了
#include
,它包含
memcmp

的声明,在C89/C90中它实际上也是未定义的行为。您应该始终为您使用的任何库函数包含适当的标题。