strcat_s 在哪个图书馆?

In what library is strcat_s?

我尝试包含 string.hstdlib.h,但仍然出现未定义引用编译错误。

这让我得出结论,它在我没有包含的另一个库中。它在哪里?

我正在使用 gcc 编译器 - 代码是用 Windows 编写的,但将在 unix 服务器上编译和 运行。

strcat_s 可以在 string.h as of C 2011 中找到。一般来说,只有微软实现了这些替代功能。

windows platform

string.h 中出现

你也可以参考这个cppreference

Defined in header <string.h>

如果您在 UNIX 平台上工作,您可以更好地使用 strcat

它似乎是 C11 标准的一部分:

http://en.cppreference.com/w/c/string/byte/strcat

https://www.securecoding.cert.org/confluence/display/c/API02-C.+Functions+that+read+or+write+to+or+from+an+array+should+take+an+argument+to+specify+the+source+or+target+size

老实说,我对标准不是很精通,我很可能是错的>.<

slibc 中有一个实现。