Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
128 Views

memset_s

I am trying to use memset_s.

I have version icpc version 16.0.3.210

The compiler says the symbol is undefined.

I have tried including strings.h and also defining __STDC_WANT_LIB_EXT1__

 

 

0 Kudos
4 Replies
Highlighted
Moderator
113 Views

Hi,

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

Goutham


0 Kudos
Highlighted
Moderator
109 Views

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

#include <stdio.h>

#include <string.h>

#include <stdlib.h>


int main(void)

{

  char temp_str[10];

  #ifdef __STDC_LIB_EXT1__

  memset_s(temp_str, 'H', sizeof(temp_str));

#endif

}



0 Kudos
Highlighted
Beginner
104 Views

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 16.0.3.210

The version of gcc on the machine I compile with is 4.4.7

Thanks,
Tom

 

 

0 Kudos
Highlighted
Moderator
100 Views

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 16.0.3.210 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++



0 Kudos