c-minheap-array icon indicating copy to clipboard operation
c-minheap-array copied to clipboard

can't make install

Open PDiracDelta opened this issue 6 years ago • 0 comments

After running make, I get this (I'm entirely new to C, I don't know what to make of this error):

cc -Wall -std=c99 -O2   -c -o heap.o heap.c
heap.c: In function ‘map_in_pages’:
heap.c:54:73: error: ‘MAP_ANON’ undeclared (first use in this function); did you mean ‘_PC_MAX_CANON’?
     void* addr = mmap(NULL, page_count*PAGE_SIZE, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0);
                                                                         ^~~~~~~~
                                                                         _PC_MAX_CANON
heap.c:54:73: note: each undeclared identifier is reported only once for each function it appears in
heap.c: In function ‘heap_create’:
heap.c:103:21: warning: implicit declaration of function ‘getpagesize’; did you mean ‘heap_size’? [-Wimplicit-function-declaration]
         PAGE_SIZE = getpagesize();
                     ^~~~~~~~~~~
                     heap_size
heap.c: In function ‘heap_insert’:
heap.c:188:9: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration]
         memcpy(new_table, h->table, h->allocated_pages*PAGE_SIZE);
         ^~~~~~
heap.c:188:9: warning: incompatible implicit declaration of built-in function ‘memcpy’
heap.c:188:9: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’
heap.c: In function ‘heap_delmin’:
heap.c:347:9: warning: incompatible implicit declaration of built-in function ‘memcpy’
         memcpy(new_table, h->table, used_pages*PAGE_SIZE);
         ^~~~~~
heap.c:347:9: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’
<builtin>: recipe for target 'heap.o' failed
make: *** [heap.o] Error 1

PDiracDelta avatar Jan 29 '19 22:01 PDiracDelta