error: warning: incompatible implicit declaration of built-in function ‘memcpy’ [enabled by default]

user2073729 picture user2073729 · Feb 28, 2013 · Viewed 51.3k times · Source

I get this error.

error: warning: incompatible implicit declaration of built-in function ‘memcpy’ [enabled by default]

This is the code:

int arr[ 12] = {1,0,0,0,0,0,0,0,0,0,9370, 0};
void *a = &arr;
memcpy(machine->mem, a,12*4);

What I am doing wrong?

Answer

cnicutar picture cnicutar · Feb 28, 2013

You likely forgot to include <string.h>.

Add #include <string.h> to the top of your file.