Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

memcpy was not declared error in eclipse CDT C++

Tags:

c

memcpy

I am trying to do memcpy

 char *pdata = data pointer;
 int64_t deviceId;
 memcpy(&deviceId, pdata+1, 8);

And it complains "memcpy was not declared in this scope"

I have included below libraries in my header file

<stdio.h>
<stdlib.h>
<unistd.h>

How do I fix this problem. Thank in advance..

like image 528
codereviewanskquestions Avatar asked Jun 17 '11 07:06

codereviewanskquestions


2 Answers

mempcy is defined in string.h, excerpt from man:

 SYNOPSIS
 #include <string.h>

 void *
 memcpy(void *restrict s1, const void *restrict s2, size_t n);
like image 72
Gregory Pakosz Avatar answered Nov 16 '22 01:11

Gregory Pakosz


memcpy is in string.h , so add it

http://www.cplusplus.com/reference/clibrary/cstring/memcpy/

like image 38
SergeS Avatar answered Nov 16 '22 00:11

SergeS