undefine reference to 'strcpy_s' error when using strcpy_s

Asked 2 years ago, Updated 2 years ago, 61 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.

Environment
Ubuntu 20.04
exclude IDE

Here's the code:

#include<stdio.h>
# include <string.h>

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

printf("Enter String\n");

scanf("%s",B);

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

printf("A=%s",A);

return 0;

}

c++ linux ubuntu

2022-09-30 13:50

2 Answers

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.