GuyTal
GuyTal

Reputation: 207

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.

Upvotes: 1

Views: 4513

Answers (2)

haccks
haccks

Reputation: 106012

bzero is a non-standard C function used in system programming and that's causing the conflict on your system. It has prototype

void bzero(void *s, size_t n);

Upvotes: 0

ouah
ouah

Reputation: 145829

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.

Upvotes: 4

Related Questions