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

problem with memmove, undefined identifier

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



Joined: 14 Mar 2006
Posts: 45

View user's profile Send private message

problem with memmove, undefined identifier
PostPosted: Thu Dec 09, 2010 12:01 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 09, 2010 1:19 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 09, 2010 12:12 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Dec 09, 2010 12:24 pm     Reply with quote

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