Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

memset_s

tpm
Beginner
621 Views

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
5 Replies
GouthamK_Intel
Moderator
606 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


Viet_H_Intel
Moderator
602 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

}



tpm
Beginner
597 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

 

 

Viet_H_Intel
Moderator
593 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++



Viet_H_Intel
Moderator
337 Views

This issue has been resolved and we will no longer respond to this thread.  

If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only.

Thanks,



Reply