I'm working on a project in which I have a header which defines list
and list_elem
structures much like the actual c libraries(the implementation of lists has no bugs). I'm writing a source file which uses the list implementation and I receive the following warning:
warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration]
This is the declaration of the list_elem
structure
/* List element. */
struct list_elem
{
struct list_elem *prev; /* Previous list element. */
struct list_elem *next; /* Next list element. */
};
Which I use here:
//creates a list element
struct list_elem le_current;
&le_current = (struct list_elem *)malloc(sizeof(struct list_elem));
I know there is another question with the same issue, but unlike that person, I did include
#include <stdlib.h>
and also the header which defines the lists
#include "lib/kernel/list.h"