c++ - CA2W 给了我一个 "' AtlThrowLastWin3 2': identifier not found"错误

标签 c++ unicode visual-studio-2005 atl big5

当我遵循 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/

相关文章:

c++ - Windows Vista/7 中的控制台/命令提示符全屏

java - 为什么我的 Java Charset.defaultCharset() 是 GBK 而不是 Unicode?

c++ - 在 C++ win32 控制台应用程序中输出 unicode 符号 π 和 ≈

asp.net - Web 应用程序项目对比网站项目

vb.net - 如何在 ListView 中删除多余的列

c++ - CreateFile2、WriteFile 和 ReadFile : how can I enforce 16 byte alignment?

c++ - OpenCV:HSV inRange 返回压缩和重复的二值图像

Python 打印结果为 '7\xe6\x9c\x8810\xe6\x97\xa5' ,但我想要 '7月10日'

visual-c++ - 如何解决Visual Studio(LNK2005)中的此链接错误?

c++ - Mat对象不在数据变量中时,该对象将数据存储在哪里?