非MFC的DLL中使用CString类

来源:互联网 发布:通用摄像头监控软件 编辑:程序博客网 时间:2024/05/21 09:38

1.头文件添加

/* 非MFC DLL中使用CString */
#define _AFXDLL
#include <afx.h>


注意:要定义在 #include<windows.h>之前,否则会报错


2.cpp 文件中添加 

/* 非MFC DLL中使用CString */
// The following symbol used to force inclusion of this module for _USRDLL 
#ifdef _X86_
extern "C" { int _afxForceUSRDLL; }
#else
extern "C" { int __afxForceUSRDLL; }
#endif


3.OK 使用CString

0 0