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 CCS Technical Support

stdlib trouble

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



Joined: 19 Jul 2008
Posts: 16

View user's profile Send private message

stdlib trouble
PostPosted: Sat Jul 19, 2008 3:50 pm     Reply with quote

Hi. I'm getting a strange error regarding #include stdlib.h. The program suddenly can't find that file. When I compile this code:

Code:
#include <18F2620.h>
#FUSES HS
#FUSES NOWDT
#FUSES NOPROTECT
#use delay(clock=20,000,000)
#use rs232 (baud = 9600, parity = N, xmit = PIN_C6, rcv = PIN_C7, bits = 8, force_sw, invert)
#define KEYHIT_DELAY 500
#define RAND_MAX 1000
#include < STDLIB.H >

int16 delays;

void main()
{
while(true){
   delays = RAND();
   output_high (PIN_C4);
   //delay_ms(1000);
   delay_ms(delays);
   output_low (PIN_C4);
   //delay_ms(1000);
   delay_ms(delays);
}
}



I get these errors:

*** Error 18 "stdlibtest.c" Line 9(10,22): File can not be opened
Not in "C:\Program Files\PICC\devices\STDLIB.H"
Not in "C:\Program Files\PICC\drivers\STDLIB.H"
Not in local "C:\Documents and Settings\Administrator\Desktop\STDLIB.H"
***Error 12 "stdlibtest.c" Line 16(13,17): Undefined identifier RAND
2 Errors, 0 Warnings.


This was working fine, and then stopped for no reason that I can discern. STDLIB.H is in the drivers folder. I have also tried to moving it to the devices folder. Anyone know what the problem might be?

Thanks!
Richard
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Jul 19, 2008 3:56 pm     Reply with quote

You have inserted some spaces in one of the lines in your program. You
have never seen this done in any example program. Remove those
spaces and the errors will go away.

The basic rule is, don't arbitrarily change things from the way you've
seen it done in example files. Try to keep it the same way they do it.
rwjzownts



Joined: 19 Jul 2008
Posts: 16

View user's profile Send private message

Thanks!
PostPosted: Sat Jul 19, 2008 4:01 pm     Reply with quote

That did it. Don't know how those spaces got there. I'll pay attention to those in the future.
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