项目原是个Win32的DLL,现在希望在项目中使用CString
把项目MFC使用改为了"在静态库中使用 MFC"
把#include "Windows.h"替换成了#include "afxwin.h"
在stdafx.h中添加了
#ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
#define WINVER 0x0500 // Win2k
#endif#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0500 // Win2k
#endif
编译的时候提示:1>nafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 已经在 dllmain.obj 中定义
接下来还需要再该什么啊?
把项目MFC使用改为了"在静态库中使用 MFC"
把#include "Windows.h"替换成了#include "afxwin.h"
在stdafx.h中添加了
#ifndef WINVER // Specifies that the minimum required platform is Windows Vista.
#define WINVER 0x0500 // Win2k
#endif#ifndef _WIN32_WINNT // Specifies that the minimum required platform is Windows Vista.
#define _WIN32_WINNT 0x0500 // Win2k
#endif
编译的时候提示:1>nafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 已经在 dllmain.obj 中定义
接下来还需要再该什么啊?
解决方案 »
- 按下一个键盘持续3秒完成一个功能,怎么判断这个键盘按下了3秒?
- 我要将同一个库里 ,表news的数据导到aaa表里 , 字段大都不一样?怎么做?
- 是一个关于菜单的小问题
- 关于读取数据库时用递归调用读完所有记录的问题?
- 散分了,都进来阿!!!!
- 构造函数的一个问题
- 如何快速高效地取得MP3文件的长度(秒)?
- 如何将字符串写入文本文件并能够在每次写入字符串时,能追加到以前写入的字符串后面?
- MFC窗口程序从便携设备中读取文件
- 新手关于opencv3.1使用objectDetection的不解之处
- OnTimer只触发一次可能的原因是什么?
- 在系统过程函数中使用WM_LBUTTONDLBCLK出错,为什么呢
#ifdef _DEBUG
#pragma comment(lib, "libcmtd.lib")
#else
#pragma comment(lib, "libcmt.lib")
#endif
2、工程目录下创建一个DLLMODUL.CPP文件,并且把它加入到当前工程中。
3、打开DLLMODUL.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
4、打开stdafx.h,把afx.h包含在windows.h前面。现在可以正常的使用CString了。