1 赋值一下代码到工程
#ifdef _DEBUG
#pragma comment(lib, "libcmtd.lib")
#else #pragma comment(lib, "libcmt.lib")
#endif
2 在工程中建一个CPP文件DLLMODEUL.CPP
3 此CPP文件内容如下
#include "stdafx.h"
#ifdef _DEBUG
#undef THIS_FILE static char THIS_FILE[] = __FILE__;
#endif
#define new DEBUG_NEW / // global data // The following symbol used to force inclusion of this module for _USRDLL
#ifdef _X86_ extern "C" { int _afxForceUSRDLL; } #else extern "C" { int __afxForceUSRDLL; } #endif #include "stdafx.h"
#ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #define new DEBUG_NEW / // global data // The following symbol used to force inclusion of this module for _USRDLL #ifdef _X86_ extern "C" { int _afxForceUSRDLL; } #else extern "C" { int __afxForceUSRDLL; } #endif
4 打开stdafx.h,把afx.h包含在windows.h前面
5 ok