I programmed an example on my Win64 PC with code:blocks using strcpy_s and strcat_s. The program works, but I get the warning messages "warning: implicit declaration of function 'strcpy_s' for strc_s and strcat_s respectively. The compiler settings have C11 enabled. And why can't I find the two functions in string.h?
// This program uses strcpy_s and strcat_s to build a phrase.
#include <string.h> // for strcpy_s, strcat_s
#include <stdio.h> // for printf
int main(void)
{
char stringBuffer[80];
strcpy_s(stringBuffer, sizeof(stringBuffer), "Hello world from ");
strcat_s(stringBuffer, sizeof(stringBuffer), "strcpy_s ");
strcat_s(stringBuffer, sizeof(stringBuffer), "and ");
strcat_s(stringBuffer, sizeof(stringBuffer), "strcat_s!");
printf("stringBuffer = %s\n", stringBuffer);
}
From cppreference:
See also: __STDC_LIB_EXT1__ availability in gcc and clang