小编med*_*dis的帖子

未明确引用`strcpy_s'无法编译

我按照这本书,无法编译这个例子.有什么建议?

  1 #define __STDC_WANT_LIB_EXT1__ 1
  2 #include <string.h>
  3 #include <stdio.h>
  4 
  5 
  6 int main(void)
  7 {
  8         char source[] = "Here we go...";
  9         char destination[50];
 10 
 11         if(strcpy_s(destination, sizeof(destination), source))
 12                 printf("An error occurred copying the string.n");
 13 
 14 
 15         return 0;
 16 }
Run Code Online (Sandbox Code Playgroud)

错误:

/tmp/ccc5KZDZ.o: In function `main':
test.c:(.text+0x48): undefined reference to `strcpy_s'
collect2: error: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)

c reference undefined tr24731 strcpy

0
推荐指数
1
解决办法
5103
查看次数

标签 统计

c ×1

reference ×1

strcpy ×1

tr24731 ×1

undefined ×1