[英]Migrating Visual C++ project to Visual Studio 2013 - DirectShow baseclasses error C2169
I've migrated a Visual C++ project to Visual Studio 2013. When I try to build the project, the compiler returns the following error : 我已将Visual C ++项目迁移到Visual Studio2013。当我尝试构建项目时,编译器返回以下错误:
Error 2 error C2169: '_InterlockedIncrement' : intrinsic function, cannot be defined
The error is in combase.h ( header from DirectShow ) and the code is : 错误在combase.h(DirectShow的标头)中,代码为:
static inline LONG WINAPI InterlockedIncrement(volatile LONG * plong) { return InterlockedIncrement( const_cast<LONG*>( plong ) ); }
InterlockedIncrement is defined in winnt.h as : 在winnt.h中将InterlockedIncrement定义为:
#define InterlockedIncrement _InterlockedIncrement
Do you know any solution for this error ? 您知道此错误的任何解决方案吗?
Your #define
replaces all the occurrences of InterlockedIncrement
with _InterlockedIncrement
, so static inline LONG WINAPI InterlockedIncrement(volatile LONG * plong)
becomes static inline LONG WINAPI _InterlockedIncrement(volatile LONG * plong)
. 您的
#define
用_InterlockedIncrement
替换了所有出现的InterlockedIncrement
,因此static inline LONG WINAPI InterlockedIncrement(volatile LONG * plong)
变为static inline LONG WINAPI _InterlockedIncrement(volatile LONG * plong)
。
Which means you actually are trying to define the _InterlockedIncrement
function, which is prohibited as it's an intrinsic. 这意味着您实际上正在尝试定义
_InterlockedIncrement
函数,该函数是_InterlockedIncrement
函数,因此被禁止。
I think you need to remove 我认为您需要删除
#define InterlockedIncrement _InterlockedIncrement
and make InterlockedIncrement
call _InterlockedIncrement
with appropriate argument conversion if needed. 并根据需要使用适当的参数转换使
InterlockedIncrement
调用_InterlockedIncrement
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.