正文

Microsoft Visual C++ 6.0 各类工程配置说明(一)2007-04-23 14:34:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/xboy/25159.html

分享到:

  1.   基于对话框(/单文档/多文档)的MFC程序 #include <afxdtctl.h>     // MFC support for Internet Explorer 4 Common #include <afxwin.h>      // MFC core and standard components #include <afxext.h>      // MFC extensions #include <afxdisp.h>     // MFC Automation classes #define VC_EXTRALEAN     // Exclude rarely-used stuff from Windows headers stdafx.h预编译头文件 afxext.h声明MFC一些扩展类(CBitmapButton、CControlBar、CSplitterWnd等) afxdisp.h中声明了Ole的几个类(COleException、COleVariant等) afxwin.h声明MFC封装的一些很基本的类(CWnd、CView、CButton、CDC等)afxdtctl.h声明几个控件类(CImageList、CMonthCalCtrl、CDateTimeCtrl等)Controls afxcmn.h声明MFC一些控件(CListCtrl、CProgressCtrl、CToolTipCtrl等) #include <afxcmn.h>     // MFC support for Windows Common Controls #ifndef _AFX_NO_AFXCMN_SUPPORT#endif // _AFX_NO_AFXCMN_SUPPORT (1.1)Use MFC in a Shared DLLDebug版本:预定义:WIN32,_DEBUG,_WINDOWS,_AFXDLL,_MBCS编译参数:/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR"Debug/" /Fp"Debug/ExeDlg.pch" /Yu"stdafx.h" /Fo"Debug/" /Fd"Debug/" /FD /GZ      /c 连接参数:/nologo /subsystem:windows /incremental:yes /pdb:"Debug/ExeDlg.pdb" /debug /machine:I386 /out:"Debug/ExeDlg.exe" /pdbtype:sept Release版本:预定义:与Debug版本相比,将_DEBUG替换成了NDEBUG编译参数:/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"Release/ExeDlg.pch" /Yu"stdafx.h" /Fo"Release/" /Fd"Release/" /FD /c 连接参数:/nologo /subsystem:windows /incremental:no /pdb:"Release/ExeDlg.pdb" /machine:I386 /out:"Release/ExeDlg.exe" (1.2)Use MFC in a Static LibraryDebug版本:预定义:与(1.1)相比,少了_AFXDLL编译参数:将/MDd(使用Run-time library: Debug Multithreaded DLL)换成了/MTd(使用Run-time library: Debug Multithreaded)连接参数:与(1.1)相同Release版本:编译参数/MD(使用Run-time library: Multithreaded DLL)换成了MT(使用Run-time library: Multithreaded)***备注:以上编译/连接参数含义如下(更多的,请参考Msdn):/nologo:抑制信息在编译或者连接时在Output Window输出;      /MD:运行时库使用MSVCRT.DLL;      /W3:编译时显示为Warning的级别为3;      /Gm:Enable Minimal Rebuild,一种减少重编译的选项;     /GX:Enable Exception Handling;        /ZI:设置Debug信息保存的数据库文件.PDB中;       /Od:Disable代码优化;        /FR:生成.SBR文件,包含有符号信息;          /Fp:命名生成的预编译头文件;        /Yu:指定预编译头文件。2.MFC DLL项目预编译头文件stdafx.h:#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers#include <afxwin.h>            // MFC core and standard components#include <afxext.h>            // MFC extensions#ifndef _AFX_NO_OLE_SUPPORT#include <afxole.h>            // MFC OLE classes#include <afxodlgs.h>          // MFC OLE dialog classes#include <afxdisp.h>           // MFC Automation classes#endif // _AFX_NO_OLE_SUPPORT#ifndef _AFX_NO_DB_SUPPORT#include <afxdb.h>               // MFC ODBC database classes#endif // _AFX_NO_DB_SUPPORT#ifndef _AFX_NO_DAO_SUPPORT#include <afxdao.h>               // MFC DAO database classes#endif // _AFX_NO_DAO_SUPPORT#include <afxdtctl.h>           // MFC support for Internet Explorer 4 Common Controls#ifndef _AFX_NO_AFXCMN_SUPPORT#include <afxcmn.h>               // MFC support for Windows Common Controls#endif // _AFX_NO_AFXCMN_SUPPORT增加了两个OLE的头文件和两个数据库的头文件(2.1) Use MFC in a Shared DLLDebug版本:预定义:WIN32,_DEBUG,_WINDOWS,_WINDLL,_AFXDLL,_MBCS,_USRDLL,与MFC Exe程序相比,增加了_WINDLL和_USRDLL编译参数:与MFC Exe没有太大区别连接参数:/nologo /subsystem:windows /dll /incremental:yes /pdb:"Debug/MFCDll.pdb" /debug /machine:I386 /def:".\MFCDll.def" /out:"Debug/MFCDll.dll" /implib:"Debug/MFCDll.lib" /pdbtype:sept 与MFC Exe相比,增加了/dll定义,以及/def:".\MFCDll.def"和/implib:"Debug/MFCDll.lib"。注意:其中MFCDll是测试的项目名字,非标准DLL名字。从项目的文件上看,这个项目比MFC Exe多产生一个.def的文件用于定义导出函数。Release版本与Debug版本的区别类似项目1中的比较(上了_AFXDLL定义)。(2.2) Use MFC in a Static DLL与(2.1)的区别,主要在使用的Run-time library类型上,与项目1中的比较。3.MFC Extension DLL项目预编译头文件stdafx.h内容与项目2相同。(3.1) Use MFC in a Shared DLLDebug版本:预定义:WIN32,_DEBUG,_WINDOWS,_MBCS,_AFXEXT,_WINDLL,_AFXDLL,与项目2相比,将_USRDLL换成了_AFXEXT。编译参数:与上述项目没有太大区别连接参数:与MFC DLL项目相似Release版本与Debug版本的区别类似项目1中的比较(上了_AFXDLL定义)。(3.2) Use MFC in a Static DLL类似以上项目的比较。(注:以下项目均以Debug版本论述。)4.Win32 DLL项目预编译头文件stdafx.h:#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers                  #include <windows.h>出现项目入口函数DllMain的实现。(4.1) Not Using MFC预定义:WIN32,_DEBUG,_WINDOWS,_MBCS,_USRDLL,WIN32DLLDEMO_EXPORTS,与项目2(MFC DLL)相比,少了_WINDLL,_AFXDLL,而仅保留了_USRDLL。另外,WIN32DLLDEMO_EXPORTS自定义的导出宏。编译参数:没有太大区别。连接参数:kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /incremental:yes /pdb:"Debug/Win32DllDemo.pdb" /debug /machine:I386 /out:"Debug/Win32DllDemo.dll" /implib:"Debug/Win32DllDemo.lib" /pdbtype:sept 与MFC DLL项目相比,多了很多库的连接,少了/subsystem:windows的定义。

阅读(6348) | 评论(0)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

暂无评论
您需要登录后才能评论,请 登录 或者 注册