View previous topic :: View next topic |
Author |
Message |
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
error: Function used but not defined ??? |
Posted: Wed Jan 16, 2013 1:15 pm |
|
|
Why I get an error by compiling this program? What does this error mean?
Here is the code:
Code: |
#include <18F4550.h>
#fuses NOWDT,NOMCLR,HS,USBDIV,PLL4,VREGEN,CPUDIV1
#use delay(clock=16M)
#include <usb_cdc.h>
#INCLUDE <stdlib.h>
void main()
{
int i;
char str[];
usb_cdc_init();
usb_init_cs();
usb_init();
while (true)
{
usb_task();
if(usb_cdc_kbhit())
{
i=get_int_usb(); //I have error on this line
usb_cdc_putc(i);
}
}
}
|
The error is:
Function used but not defined .... get_int_usb() SCR=9201
What is wrong with my code? _________________ A person who never made a mistake never tried anything new. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Wed Jan 16, 2013 1:39 pm |
|
|
You need to load stdlib.h
The getint function uses atoi, which is not present, till stdlib is loaded.
Best Wishes |
|
|
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
|
Posted: Wed Jan 16, 2013 2:22 pm |
|
|
Thanks for answer, but I'm not sure what I need to do by loading stdlib.h?
And how exactly to load stdlib, I have included the file already. What means to load stdlib.h/
Thanks again! _________________ A person who never made a mistake never tried anything new. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Wed Jan 16, 2013 2:33 pm |
|
|
It needs to be _in front_ of the usb file.
Best Wishes |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
rikotech8
Joined: 10 Dec 2011 Posts: 376 Location: Sofiq,Bulgariq
|
|
Posted: Thu Jan 17, 2013 1:03 pm |
|
|
Thanks to both of you! My problem has been solved. _________________ A person who never made a mistake never tried anything new. |
|
|
|