123
123

Reputation: 5824

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.

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?

Upvotes: 3

Views: 6979

Answers (1)

user539810
user539810

Reputation:

You forgot to #include <string.h>, which contains the declaration of memcmp.

Upvotes: 12

Related Questions