Strcpy_s does not work with gcc

I have a C ++ 11 project, and I have added some method calls strcpy_s. This works with windows, but when compiling on gcc, an error occurs that the character was strcpy_snot found.

I added a line

#define __STDC_WANT_LIB_EXT1__ 1

to the code, to no avail.

+4
source share
2 answers

GCC (or rather glibc) does not support strcpy_s()friends either . For some ideas on where you can find a library that supports them, see here: Are there any free implementations of strcpy_s and / or TR24731-1?

+6
source

strcpy_s ++. , ++ 17 , . , glibc .

, cppreference, __STDC_WANT_LIB_EXT1__ , __STDC_LIB_EXT1__. Arch Linux .

#ifdef __STDC_LIB_EXT1__
constexpr bool can_have_strcpy_s = true;
#else
constexpr bool can_have_strcpy_s = false;
#endif

strncpy. .

+4

Source: https://habr.com/ru/post/1657780/


All Articles