4

当我按照MSDN 文档在 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

我不知道这怎么会发生。AtlThrowLastWin32的文档显示需要atldef.h,但是在atldef.h中找不到AtlThrowLastWin32的声明。

4

1 回答 1

7

我终于通过添加 2 个包含标头解决了这个问题:

#include <atlbase.h> 
#include <atlstr.h> 

我不知道为什么 MSDN 文档没有提到这一点。

于 2009-07-05T01:32:39.607 回答