View previous topic :: View next topic |
Author |
Message |
davecannacon
Joined: 12 Sep 2012 Posts: 3
|
when i execute string in ccs compiler in line 34 error arise |
Posted: Wed Oct 03, 2012 3:44 am |
|
|
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
|
|
Posted: Wed Oct 03, 2012 4:12 am |
|
|
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
|
|
Posted: Wed Oct 03, 2012 1:18 pm |
|
|
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
|
when i execute string in ccs compiler in line 34 error arise |
Posted: Wed Oct 03, 2012 9:39 pm |
|
|
it works thanks |
|
|
|