【问题标题】:ATL(atlalloc.h) generates errors while compilingATL(atlalloc.h) 在编译时产生错误
【发布时间】:2014-03-15 16:21:58
【问题描述】:

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

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 的东西吗?

【问题讨论】:

    标签: c++ visual-c++ atl


    【解决方案1】:

    您的代码中有一些内容从编译器输入中排除了AtlThrowImpl

    • 你以某种方式排除了&lt;atlexcept.h&gt;
    • 或者,您定义了_ATL_NO_EXCEPTIONS
    • 或者,您定义了_ATL_CUSTOM_THROW
    • 或者,你已经定义了__ATLEXCEPT_H__,而不是通过包含&lt;atlexcept.h&gt;

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

    【讨论】:

    • 你能给我一个链接,我可以从那里下载所有 atl 的标题吗?
    • ATL 随 MS Visual Studio 一起提供,不包括免费的 Express 版本。没有下载链接。 DDK 可以免费获得一段相当古老的 ATL。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-06-11
    • 2021-11-27
    • 2010-09-10
    • 2014-09-15
    • 2016-10-14
    • 2011-10-06
    • 1970-01-01
    相关资源
    最近更新 更多