非MFC的DLL中使用CString类

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

原文地址:https://www.cnblogs.com/mqxnongmin/p/10857123.html