First, the header file of string
1. <string>
C + + header file with Std wrapped
2. <string.h>
The old C header file
3. <cstring.h>
STD version of the old C header file, Remember that this is not the CString header file
See the 49th of effective C + +
Besides, CString's head file.
Note: Under VC9 compilation environment
1. <atlstr.h>
Non-MFC version, the console program uses this
2. <afxstr.h>
MFC version, you need to link to the MFC DLL or static library. Many people on the internet say that to include <afx.h>,<afx.h> contains more than CObject and its derived classes, as well as the file class, time class, Exception class, String class, and so on (more than 700 rows of the location contains Afxstr.h), If you just need CString, it's enough to include <afxstr.h>.
Pre-treatment in <afx.h>
#ifdef _dll
#ifndef _afxdll
#error Building MFC Application With/md[d] (CRT DLL version) requires MFC shared DLL version. Please #define _afxdll or does not use/md[d]
#endif
#endif
Pre-treatment in <afxstr.h>
#ifndef _afx
#error Afxstr.h can only is used in MFC projects. Use Atlstr.h
#endif
Notice the above #error, to the effect that this header file is used in the MFC project. Either switch to <ATLSTR.H>, or use MFC in a shared DLL, in the general, properties----, project--.