View previous topic :: View next topic |
Author |
Message |
Leef_me
Joined: 14 Mar 2006 Posts: 45
|
problem with memmove, undefined identifier |
Posted: Thu Dec 09, 2010 12:01 am |
|
|
I am using PCH 4.099 with PIC18F26K20
If I try to compile this code, the memcpy compiles, but the memmove fails. The error is error 12, undefined identifier -- memmove
1. Can someone confirm the failure in 4.099 ?
2. Can someone confirm that it has been fixed in a later version ?
Code: | #include <18F26K20.h>
#define num 25
void main(void)
{
signed int32 o[num];
memcpy(&o[1], &o[0], 24 * sizeof (signed int32));
memmove(o[1], o[0], 24 * sizeof (signed int32));
} |
However, if I change the example file ex_usb_bootloader.c
by adding a memmove line after the memcpy line
Like this:
Code: |
memcpy(&rom_block[i], src, num); //modify ram buffer
memmove(&rom_block[i], src, num); //modify ram buffer
|
the example file compiles. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Dec 09, 2010 1:19 am |
|
|
memmove() is in string.h. You have to #include string.h in your program.
Also, memmove() uses pointers. Your first code example doesn't use
pointers for the first two parameters. That needs to be fixed. |
|
|
Leef_me
Joined: 14 Mar 2006 Posts: 45
|
|
Posted: Thu Dec 09, 2010 12:12 pm |
|
|
Thanks PCM. The changes fixed the problem.
The CCS manual fails to note the <string.h> requirement; the manual lumps together memcpy and memmove.
And a www web search failed as well. |
|
|
gpsmikey
Joined: 16 Nov 2010 Posts: 588 Location: Kirkland, WA
|
|
Posted: Thu Dec 09, 2010 12:24 pm |
|
|
Yes, it would definitely be helpful if the compiler manual did indicate what .h files were needed like the typical man page for the Unix world. From the man page for "strcmp" (on my Ubuntu machine):
Code: | NAME
strcmp, strncmp - compare two strings
SYNOPSIS
#include <string.h>
int strcmp(const char *s1, const char *s2);
int strncmp(const char *s1, const char *s2, size_t n);
|
mikey _________________ mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3 |
|
|
|