Search code examples
cxcodeexecutablememset

Xcode error "Conflicting types" running a C code for a very simple function


I am trying to run to following function as part of a bigger project:

#include <memory.h>

void bzero(char *s, int n)
{
    memset (s, 0, n);
}

I am getting the following error: "Conflicting types for 'bzero'"

I don't understand the problem, since the entire projects works fine on Linux. So I am actually trying to transfer it onto Mac and to create and executable file using Xcode, but it won't even built.


Solution

  • In your system there is already a bzero function (a legacy POSIX function that is now removed) with a different prototype. Name your function differently like my_bzero.