title: Undefined reference to memcpy_s
body: <p>I'm trying to fix an undefined reference to <code>memcpy_s()</code> error. I've included <code>string.h</code> in my file and the <code>memcpy()</code> function works okay, and I've also tried including <code>memory.h</code>. I'm on x64 Windows 7 and using gcc 4.8.1 to compile.</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  void doMemCopy(char* buf, size_t buf_size, char* in, int chr) {
      memcpy_s(buf, buf_size, in, chr);
  }
  </code></pre>
  
  <p>memory for <code>buf</code> has been allocated in the main function, which calls <code>doMemCpy(buf, 64, in, bytes)</code>. <code>in</code> is a string read from standard input</p>
  
  <p>Exact error from cmd terminal: </p>
  
  <blockquote>
    <p>undefined reference to "memcpy_s" collect2.exe: error: ld returned 1 exit status</p>
  </blockquote>