3

I tried including string.h and stdlib.h, but still get undefined reference compile errors.

This leads me to conclude that it is in a different library that I didn't include. Where is it?

I am using gcc compiler - the code is written in Windows, but is going to be compiled and run on a unix server.

Sunspawn
  • 817
  • 1
  • 12
  • 27
  • Can your edit your post with what environment you are using (OS and compiler)? Thanks. – ryyker May 26 '15 at 17:40
  • Use `strcat` instead. There's no reason to use `strcat_s` except for making your code less portable. – fuz May 26 '15 at 17:40

4 Answers4

9

strcat_s can be found in string.h as of C 2011. Generally speaking, only microsoft has implemented these alternative functions.

Bill Lynch
  • 80,138
  • 16
  • 128
  • 173
4

It is present in string.h on windows platform

You can also refer this cppreference

Defined in header <string.h>

You can better use strcat if you are working on UNIX platform.

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
4

There's an implementation in slibc.

Constantinius
  • 34,183
  • 8
  • 77
  • 85
4566976
  • 2,419
  • 1
  • 10
  • 14
2

It seems it is part of C11 standard:

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

enter image description here

Honestly, I am not very well-versed with when it comes to standards and I can very well be wrong >.<

Abhinav
  • 2,085
  • 1
  • 18
  • 31