编译器在编译我的代码时出现了一些错误。 错误:
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/