Conflicting types for 'memchr'

908 Views Asked by At

I'm currently trying to modify a library (ASN.1 Compiler), written in C, so I can compile and use it in C++ Builder (XE6). Doing that, I've encountered the error "Conflicting types for 'memchr'" (in cstring).

After some research, it seems that this problem comes from the fact that C and C++ code are mixed. However, I can't use the solutions suggested by the article in which I read that since they are related to the GCC compiler, when I'm using C++ Builder and its compilers.

What can be the solutions to solve this error?

Thank you

1

There are 1 best solutions below

2
alk On BEST ANSWER

You probably mix including cstring and string.h. Do not do this.

The former declares:

void * memchr(void *, int, size_t);

the latter does

void * memchr(const void *, int, size_t);

Those are not of the same type.