cstring头文件
2014-09-22 10:38
134 查看
首先说string的头文件
1、<string>
包装了std的C++头文件
2、<string.h>
旧的C头文件
3、<cstring.h>
旧C头文件的std版本,切记,这不是cstring的头文件
详见effective c++ 的第49条
再说cstring的头文件
注:VC9编译环境下
1、<atlstr.h>
非MFC版本,控制台程序就用这个
<afx.h>、<afxcoll.h>都可以。//要在项目->属性->常规里设置为使用MFC(动/静).
2、<afxstr.h>// only be used in MFC projects.
MFC版本,需要链接MFC的dll或静态库。网上很多人说要包含<afx.h>,<afx.h>包含的东西就比较多了CObject及其派生类,还有文件类、时间类、异常类、字符串类等等(700多行的位置包含了afxstr.h),如果仅仅需要cstring的话,包含<afxstr.h>就够了。
<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 do not use /MD[d]
#endif
#endif
<afxstr.h>中的预处理
#ifndef _AFX
#error afxstr.h can only be used in MFC projects. Use atlstr.h
#endif
注意上面的#error,大意就是这个头文件是在MFC工程里用的。
1、<string>
包装了std的C++头文件
2、<string.h>
旧的C头文件
3、<cstring.h>
旧C头文件的std版本,切记,这不是cstring的头文件
详见effective c++ 的第49条
再说cstring的头文件
注:VC9编译环境下
1、<atlstr.h>
非MFC版本,控制台程序就用这个
<afx.h>、<afxcoll.h>都可以。//要在项目->属性->常规里设置为使用MFC(动/静).
2、<afxstr.h>// only be used in MFC projects.
MFC版本,需要链接MFC的dll或静态库。网上很多人说要包含<afx.h>,<afx.h>包含的东西就比较多了CObject及其派生类,还有文件类、时间类、异常类、字符串类等等(700多行的位置包含了afxstr.h),如果仅仅需要cstring的话,包含<afxstr.h>就够了。
<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 do not use /MD[d]
#endif
#endif
<afxstr.h>中的预处理
#ifndef _AFX
#error afxstr.h can only be used in MFC projects. Use atlstr.h
#endif
注意上面的#error,大意就是这个头文件是在MFC工程里用的。
相关文章推荐
- string头文件与cstring头文件
- CString和string头文件
- 头文件 string.h cstring string 区别
- CString 使用的头文件
- C/C++笔试必须熟悉掌握的头文件系列(四)——string.h/cstring
- [转]CString类型的头文件、CString的输出、CString的常用用法
- String头文件与CString头文件
- 头文件 string.h cstring string 区别
- string头文件与cstring头文件
- C++中关于头文件<string>、<string.h>和<cstring>的区别
- string头文件与cstring头文件
- 头文件 string.h cstring string 区别
- 47.VC(custom)-string头文件与cstring头文件
- vs中CString的用法,以及所需的头文件
- cstring与string头文件与输出
- CString头文件
- string类 string.h头文件 cstring头文件区别以及读取一行字符串总结
- 头文件 string.h cstring string 区别
- 头文件 string.h cstring string 区别
- [C++STDlib基础]关于字符串的操作——C++标准库头文件<cstring>