我已将Visual C ++项目迁移到Visual Studio 2013.当我尝试构建项目时,编译器返回以下错误:
Error 2 error C2169: '_InterlockedIncrement' : intrinsic function, cannot be defined
错误在combase.h中(来自DirectShow的头文件),代码为:
static inline LONG WINAPI InterlockedIncrement(volatile LONG * plong)
{ return InterlockedIncrement( const_cast<LONG*>( plong ) ); }
InterlockedIncrement在winnt.h中定义为:
#define InterlockedIncrement _InterlockedIncrement
您是否知道此错误的任何解决方案?
答案 0 :(得分:1)
您的#define
会将所有InterlockedIncrement
替换为_InterlockedIncrement
,因此static inline LONG WINAPI InterlockedIncrement(volatile LONG * plong)
变为static inline LONG WINAPI _InterlockedIncrement(volatile LONG * plong)
。
这意味着您实际上正在尝试定义_InterlockedIncrement
函数,这是禁止的,因为它是内在函数。
我认为你需要删除
#define InterlockedIncrement _InterlockedIncrement
并根据需要使InterlockedIncrement
调用_InterlockedIncrement
并进行适当的参数转换。