It has been quite a while since I am getting this error in the standard <cstring> header file for no apparent reason. A google search brought up many answers but none of them worked.
Asked
Active
Viewed 2.4k times
3 Answers
35
Ok I fixed it myself. It was a stupid mistake! I have a file called "String.h" in a library project which is being picked up by the <cstring> header. Probably because I have added the path to <String.h> as an additional include directory in my test project (where I am getting this error.) Hope this helps someone.

Sandeep Datta
- 28,607
- 15
- 70
- 90
-
2Man, I just spent an hour figuring it out. Thanks, it was the same problem as this. – vmpstr Mar 15 '11 at 03:09
-
1thx man, saved me a lot of time and nerves! upvote for question and answer. – Nicola Coretti Jan 24 '13 at 23:02
-
2Yes, it helps! I just wrote my own string implementation and put it to String.h file. It was some time until I decided to google error! Thanks! Shame to Microsoft... – Mar 23 '13 at 13:39
-
1Microsoft shafts us all once again. – Owl May 09 '19 at 17:19
-
1This is an insane error, I'm so happy I came across your post, thank you so much! – Matt Kae Aug 30 '20 at 23:27
1
Your compiler may be (correctly) placing the memchr function in the C++ std namespace. Try prefixing memchr call with std:: and if that fails, post the code that causes the problem.
-5
Preprocessor defines are pretty handy when you want to avoid this sort of mistake.
//whatev.h
#ifndef WHATEV
#define WHATEV
// your code here
#endif
-
2prefer using `#pragma once` since I exclusively work with MS compilers. But in any case this is not the reason why I got the error. – Sandeep Datta Feb 10 '09 at 21:59