编译我的代码时,编译器会出现一些错误。
错误:

Error   1   error C2039: 'AtlThrowImpl' : is not a member of 'ATL'  e:\program files\microsoft visual studio 9.0\vc\include\atlalloc.h  184
Error   7   error C2039: 'AtlThrowImpl' : is not a member of 'ATL'  e:\program files\microsoft visual studio 9.0\vc\include\atlalloc.h  184
Error   11  error C2039: 'AtlThrowImpl' : is not a member of 'ATL'  e:\program files\microsoft visual studio 9.0\vc\include\atlalloc.h  184
Error   16  error C2039: 'AtlThrowImpl' : is not a member of 'ATL'  e:\program files\microsoft visual studio 9.0\vc\include\atlalloc.h  184
Error   22  error C2039: 'AtlThrowImpl' : is not a member of 'ATL'  e:\program files\microsoft visual studio 9.0\vc\include\atlalloc.h  184

这是 header 的代码部分:
    template <typename T>
inline T AtlThrow(T tLeft, T    tRight)
{
    T tResult;
    HRESULT hr=AtlAdd(&tResult, tLeft, tRight);
    if(FAILED(hr))
    {
        AtlThrow(hr);
    }
    return tResult;
}

我的问题:如何从 header 中修复此错误?我是否需要安装一些SDK或一些有关ATL的东西?

最佳答案

您的代码中有些东西从编译器输入中排除了AtlThrowImpl:

  • 您以某种方式排除了<atlexcept.h>
  • 或者,您已经定义了_ATL_NO_EXCEPTIONS
  • 或者,您已经定义了_ATL_CUSTOM_THROW
  • 或,您通过包含__ATLEXCEPT_H__
  • 定义了<atlexcept.h>AtlThrowImpl在atlexcept.h中,在您面前有完整的项目,您可以检查确切的冲突并将其排除在外。

    08-16 20:04