c++ - ATL(atlalloc.h) 在编译时产生错误

标签 c++ visual-c++ atl

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

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

这是标题的代码部分:

    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;
}

我的问题:如何从标题中修复此错误?我需要安装一些 sdk 或有关 ATL 的东西吗?

最佳答案

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

  • 你以某种方式排除了<atlexcept.h>
  • 或者,您有 _ATL_NO_EXCEPTIONS定义
  • 或者,您有 _ATL_CUSTOM_THROW定义
  • 或者,您有 __ATLEXCEPT_H__通过包含 <atlexcept.h> 来定义其他

AtlThrowImpl在 atlexcept.h 中,在你面前有完整的项目,你可以检查到底有什么冲突并排除它。

关于c++ - ATL(atlalloc.h) 在编译时产生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21811002/

相关文章:

c++ - VC++知道数组中存储的元素个数

c++ - C-Free 和 MySQL 连接

c++ - linux下编译c++程序

c++ - 为什么空基类优化 (EBO) 在 MSVC 中不起作用?

windows - 右单撇号与撇号?

c++ - 有没有比声明 CStringT<> 的 char 类型适当实例更好的方法

javascript - ATL ActiveX 控件如何向 javascript 公开一个 bool 值

c++ - Eigen 实例包含另一个持有固定大小 Eigen 对象的实例

c++ - 为什么 SetUnhandledExceptionFilter 无法捕获某些异常但 AddVectoredExceptionHandler 可以

visual-c++ - C++ 调用引用类函数(混合代码)