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

when i execute string in ccs compiler in line 34 error arise

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



Joined: 12 Sep 2012
Posts: 3

View user's profile Send private message

when i execute string in ccs compiler in line 34 error arise
PostPosted: Wed Oct 03, 2012 3:44 am     Reply with quote

when i execute string in ccs compiler in line 34 error arise that #device is required can anyone solve it

Code:

         *sc1++=*sc2++;
  return s1;
  }

/* compiler ignored the name 'strcpy()'; perhaps, it's reserved?
   Standard template: char *strcpy(char *s1, const char *s2)
   copies the string s2 including the null character to s1*/

char *strcopy(char *s1, char *s2)
{
  char *s;

  for (s = s1; *s2 != 0; s++, s2++) {
     *s = *s2;
  }
  *s = *s2;
  return(s1);
}



++++++++++++++++++++++++++
Most of string.h removed.

Reason: Forum rule #10

10. Don't post the CCS example code or drivers

Forum rules -
http://www.ccsinfo.com/forum/viewtopic.php?t=26245

- Forum Moderator
++++++++++++++++++++++++++
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Wed Oct 03, 2012 4:12 am     Reply with quote

Post SHORT COMPLETE COMPILABLE code which we can copy to test.

Error may be further up your code.

Mike
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Oct 03, 2012 1:18 pm     Reply with quote

Quote:
line 34 error arise that #device is required

This program will cause the "line 34" error that you see:
Code:

#include <string.h>

#include <18F4520.h>
#fuses INTRC_IO,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4M)

//======================================
void main(void)
{


while(1);
}


Do not construct a program like the above code. Put the #include for
string.h after the top 3 lines. Do it like this:
Code:

#include <18F4520.h>
#fuses INTRC_IO,NOWDT,PUT,BROWNOUT,NOLVP
#use delay(clock=4M)

#include <string.h>

//======================================
void main(void)
{


while(1);
}
 

Then it will compile OK.
davecannacon



Joined: 12 Sep 2012
Posts: 3

View user's profile Send private message

when i execute string in ccs compiler in line 34 error arise
PostPosted: Wed Oct 03, 2012 9:39 pm     Reply with quote

it works thanks
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