Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | Piclist | How to use malloc() and free() in PICC?


Advertise Here

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

How to use malloc() and free() in PICC? - Bruce.J Sam - Aug 24 1:15:00 2004

I have writed a simple program like this:
/*  ******************************* */
#include <stdlib.h>

void main(void)
{
 unsigned char *ptr;

 ptr = (unsigned char *) malloc(sizeof(unsigned char));
 free(ptr);
}
/* ***************************** */
This just used to test how to use malloc() and free() in PICC.But after compiled,some error message appear:
Error[000]   : undefined symbols:
Error[000]   : _free (D:\MPLAB IDE\PICproject\Test\test.obj)
Error[000]   : _malloc (D:\MPLAB IDE\PICproject\Test\test.obj)
     I have doubt in why these error message appear.How to do dynamic memory's program such use malloc() and free() in PICC?  
     Best regards,
     Bruce .J Sam








(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )


Re: How to use malloc() and free() in PICC? - john - Aug 24 21:27:00 2004

You need to include "STDLIBM.H" to use those functions. The compiler
is giving those errors because it doesn't know what those two
functions are without STDLIBM.H included.

--- In , "Bruce.J Sam" <persevreman@y...>
wrote:
> I have writed a simple program like this:
> /* ******************************* */
> #include <stdlib.h>
>
> void main(void)
> {
> unsigned char *ptr;
>
> ptr = (unsigned char *) malloc(sizeof(unsigned char));
> free(ptr);
> }
> /* ***************************** */
> This just used to test how to use malloc() and free() in PICC.But
after compiled,some error message appear:
> Error[000] : undefined symbols:
> Error[000] : _free (D:\MPLAB IDE\PICproject\Test\test.obj)
> Error[000] : _malloc (D:\MPLAB IDE\PICproject\Test\test.obj)
> I have doubt in why these error message appear.How to do
dynamic memory's program such use malloc() and free() in PICC?
> Best regards,
> Bruce .J Sam >
> ---------------------------------





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: How to use malloc() and free() in PICC? - Bruce.J Sam - Aug 25 0:28:00 2004

Thanks john,
        But I couldn't found STDLIBM.H in the installation directory of the picc.Are there other method to solve?
        Thanks again,
        Bruce .J Sam.


john <j...@yahoo.com> wrote:
You need to include "STDLIBM.H" to use those functions. The compiler
is giving those errors because it doesn't know what those two
functions are without STDLIBM.H included.

--- In p...@yahoogroups.com, "Bruce.J Sam" <persevreman@y...>
wrote:
> I have writed a simple program like this:
> /*  ******************************* */
> #include <stdlib.h>
>
> void main(void)
> {
>  unsigned char *ptr;
>
>  ptr = (unsigned char *) malloc(sizeof(unsigned char));
>  free(ptr);
> }
> /* ***************************** */
> This just used to test how to use malloc() and free() in PICC.But
after compiled,some error message appear:
> Error[000]   : undefined symbols:
> Error[000]   : _free (D:\MPLAB IDE\PICproject\Test\test.obj)
> Error[000]   : _malloc (D:\MPLAB IDE\PICproject\Test\test.obj)
>      I have doubt in why these error message appear.How to do
dynamic memory's program such use malloc() and free() in PICC? 
>      Best regards,
>      Bruce .J Sam








(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: How to use malloc() and free() in PICC? - john - Aug 25 21:47:00 2004

Never mind about the STDLIBM.H that's for CCS's compiler, Hi-tech
PICC has a malloc.c in its sources directory you would need to add.
The malloc.c file has the free() and malloc() functions in it.

-John --- In , "Bruce.J Sam" <persevreman@y...>
wrote:
> Thanks john,
> But I couldn't found STDLIBM.H in the installation
directory of the picc.Are there other method to solve?
> Thanks again,
> Bruce .J Sam. > john <j_funk1425@y...> wrote:
> You need to include "STDLIBM.H" to use those functions. The
compiler
> is giving those errors because it doesn't know what those two
> functions are without STDLIBM.H included.
>
> --- In , "Bruce.J Sam" <persevreman@y...>
> wrote:
> > I have writed a simple program like this:
> > /* ******************************* */
> > #include <stdlib.h>
> >
> > void main(void)
> > {
> > unsigned char *ptr;
> >
> > ptr = (unsigned char *) malloc(sizeof(unsigned char));
> > free(ptr);
> > }
> > /* ***************************** */
> > This just used to test how to use malloc() and free() in
PICC.But
> after compiled,some error message appear:
> > Error[000] : undefined symbols:
> > Error[000] : _free (D:\MPLAB IDE\PICproject\Test\test.obj)
> > Error[000] : _malloc (D:\MPLAB IDE\PICproject\Test\test.obj)
> > I have doubt in why these error message appear.How to do
> dynamic memory's program such use malloc() and free() in PICC?
> > Best regards,
> > Bruce .J Sam > ---------------------------------




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )