当我遵循 MSDN document 时,我遇到了一个奇怪的编译错误在 Visual Studio 2005 中使用 CA2W 将 big5 字符串转换为 unicode 字符串。
这是我写的代码:
#include <string>
#include <atldef.h>
#include <atlconv.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string chineseInBig5 = "\xA4\xA4\xA4\xE5";
ATL::CA2W(chineseInBig5.c_str());
return 0;
}
编译错误:error C3861: 'AtlThrowLastWin32': identifier not found
我不知道怎么会这样。 document of AtlThrowLastWin32显示需要atldef.h,但我在atldef.h中找不到AtlThrowLastWin32的声明。
最佳答案
我终于通过添加 2 个包含 header 解决了这个问题:
#include <atlbase.h>
#include <atlstr.h>
我不知道为什么 MSDN 文档没有提到这一点。
关于c++ - CA2W 给了我一个 "' AtlThrowLastWin3 2': identifier not found"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1083252/