How can I use 'strcpy_s' in CLion?

Hello. I'm studying C++ with an introductory book of it.

This book is based of VS and use strcpy_s function instead of strcpy.

I know that strcpy_s is secure version of strcpy, but cannot find how I can use this function. (CLion error message: " Can't resolve variable 'strcpy_s' ")

I tried to include <string.h> and <cstring> following result of Google search, but it didn't work.

 

in CLion, how can I use 'strcpy_s' and 'strcat_s'?

Or, cannot I use it?

 

I'm sorry about poorness of English. Thanks a lot. 

2 comments
Comment actions Permalink

Can you compile your code with strcpy_s without CLion?

As cppreference states here you should use C11 and:

As all bounds-checked functions, strcpy_s is only guaranteed to be available if __STDC_LIB_EXT1__ is defined by the implementation and if the user defines __STDC_WANT_LIB_EXT1__ to the integer constant 1 before including string.h.
1
Comment actions Permalink

thanks. I'll try it.

0

Please sign in to leave a comment.