win32中如何使用CString

 MFC中CString的强大,感觉很方便,Win32里是没有CString的,怎么去使用呢?

     在StdAfx.h中加入头文件#include "AFX.h",注意加在#include<windows.h>之前,编译后会发现

    Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d] C:\Program Files (x86)\Microsoft Visual Studio 8\VC\ce\atlmfc\include\AFX.h 24

这里错误提示的意思是缺少_AFXDLL这个宏,因此在Project——>property中,C/C++里面Preprocessor(预编译),加入_AFXDLL这个宏,OK搞定!!

 

    程序运行后,突然执行到析构函数,自动退出,这种情况下没有错误提示,解决方法是Project->property,link->system中Stack Reserve Size 设为0,Stack Commit Size也设为0.

     看错误提示,是件学习的过程,不能不会啊!!

     这里记录下来,防止下次忘了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章