CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

error: Function used but not defined ???

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
rikotech8



Joined: 10 Dec 2011
Posts: 376
Location: Sofiq,Bulgariq

View user's profile Send private message

error: Function used but not defined ???
PostPosted: Wed Jan 16, 2013 1:15 pm     Reply with quote

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: 19219

View user's profile Send private message

PostPosted: Wed Jan 16, 2013 1:39 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Jan 16, 2013 2:22 pm     Reply with quote

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: 19219

View user's profile Send private message

PostPosted: Wed Jan 16, 2013 2:33 pm     Reply with quote

It needs to be _in front_ of the usb file.

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jan 16, 2013 2:54 pm     Reply with quote

Quote:

void main()
{
int i;
char str[];
usb_cdc_init();
usb_init_cs();
usb_init();

Also, the empty array in bold above will probably cause problems.
See this post:
http://www.ccsinfo.com/forum/viewtopic.php?t=30197&start=2
rikotech8



Joined: 10 Dec 2011
Posts: 376
Location: Sofiq,Bulgariq

View user's profile Send private message

PostPosted: Thu Jan 17, 2013 1:03 pm     Reply with quote

Thanks to both of you! My problem has been solved.
_________________
A person who never made a mistake never tried anything new.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group