开发者

memcpy was not declared error in eclipse CDT C++

开发者 https://www.devze.com 2023-03-13 10:34 出处:网络
I am trying to do memcpy char *pdata = data pointer; int64_t deviceId; memcpy(&deviceId, pdata+1, 8);

I am trying to do memcpy

 char *pdata = data pointer;
 int64_t deviceId;
 memcpy(&deviceId, pdata+1, 8);
开发者_StackOverflow中文版

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


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


memcpy is in string.h , so add it

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

0

精彩评论

暂无评论...
验证码 换一张
取 消