undefine reference to 'strcpy_s' error when using strcpy_s

Asked 2 months ago, Updated 2 months ago, 2 views

I have to copy the string using strcpy_s in my assignment.
The error undefine reference to 'strcpy_s' appears and cannot be executed.
strcpy is available without any problems.

I've been searching for error codes for about an hour, but I haven't been able to solve them due to my lack of ability.

I would appreciate it if you could give me an explanation.

Ubuntu 20.04
exclude IDE

Here's the code:

# include <string.h>

int main() {
char A[10];
char B[10];

printf("Enter String\n");


printf("Replace string\n";

US>strcpy_s(A,sizeof(A),B);// Cannot run
// strcpy(A,B); // Can run
// strncpy(A,B,sizeof(A)); // Can be done


return 0;


c++ linux ubuntu

2022-09-30 13:50

2 Answers

If you have any answers or tips

© 2022 OneMinuteCode. All rights reserved.