c - Undefined reference to memcpy_s -
i'm trying fix undefined reference memcpy_s()
error. i've included string.h
in file , memcpy()
function works okay, , i've tried including memory.h
. i'm on x64 windows 7 , using gcc 4.8.1 compile.
#include <stdlib.h> #include <stdio.h> #include <string.h> void domemcopy(char* buf, size_t buf_size, char* in, int chr) { memcpy_s(buf, buf_size, in, chr); }
memory buf
has been allocated in main function, calls domemcpy(buf, 64, in, bytes)
. in
string read standard input
exact error cmd terminal:
undefined reference "memcpy_s" collect2.exe: error: ld returned 1 exit status
i've never used this, afaik, need add
#define __stdc_want_lib_ext1__ 1
before
#include <string.h>
to use memcpy_s()
.
Comments
Post a Comment