problem with malloc

Guest #2791889
Rate this post
useful
not useful
Hi, I'm programming a Lpc1343.
I have to create a list of elements,

struct lista {
   uint16_t inf;
   struct lista *pun;
};

struct lista *punt;
punt = (struct lista *)malloc(sizeof(struct lista));

but when i call the malloc, the compiler returns me the following error:

home/francesco/Programs/arm-2011.03/bin/../lib/gcc/arm-none-eabi/4.5.2/. 
./../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-sbrkr.o):  In function 
`_sbrk_r':
sbrkr.c:(.text+0x12): undefined reference to `_sbrk'
Guest #2792417
Rate this post
useful
not useful
Looks like you use a memory model without heap management.
You need to use a memory model which supports heap (malloc etc).
In your C compiler there should be a setting to select the memory model 
somewhere. Check the compiler manual for details.

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now