Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我尝试包含string.hand stdlib.h,但仍然得到未定义的引用编译错误。
string.h
stdlib.h
这使我得出结论,它位于我未包含的不同库中。它在哪里?
我正在使用 gcc 编译器 - 代码是用 Windows 编写的,但将在 unix 服务器上编译和运行。
strcat_s可以在string.hC 2011 中找到。一般来说,只有 microsoft 实现了这些替代功能。
strcat_s
它存在于string.hWindows平台上
你也可以参考这个cppreference
在标题中定义<string.h>
<string.h>
如果您在 UNIX 平台上工作,则可以更好地使用strcat 。
在slibc中有一个实现。
它似乎是 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+指定+the+source+or+target+size
老实说,在标准方面我不是很精通,我很可能是错的>.<