I am trying to use memset_s.
I have version icpc version 18.104.22.168
The compiler says the symbol is undefined.
I have tried including strings.h and also defining __STDC_WANT_LIB_EXT1__
Thanks for reaching out to us!
We are able to reproduce the same error on our end. We are forwarding this thread to the concerned internal team.
Thanks & Regards
memcpy_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. (https://en.cppreference.com/w/c/string/byte/memcpy)
$ icpc mem_s.cpp -c
$ cat mem_s.cpp
#define __STDC_WANT_LIB_EXT1__ 1
memset_s(temp_str, 'H', sizeof(temp_str));
I have tried previously what you have. I am still having issues.
Do I need a certain version of gcc for this to work?
If so how do I point icpc to a different version of gcc?
I am using:
Intel icpc version 22.214.171.124
The version of gcc on the machine I compile with is 4.4.7
I don't have a system with gcc4.4. but it worked on gcc4.8
$ icpc mem_s.cpp -c -V
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 126.96.36.199 Build 20160415
Copyright (C) 1985-2016 Intel Corporation. All rights reserved.
vahoang@orcsle147:/tmp$ gcc -v
gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)
You can set -gcc-name=/gxx-name= to point to a location of gcc/g++