简体   繁体   中英

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 :

Error 2 error C2169: '_InterlockedIncrement' : intrinsic function, cannot be defined

The error is in combase.h ( header from DirectShow ) and the code is :

static inline LONG WINAPI InterlockedIncrement(volatile LONG * plong) { return InterlockedIncrement( const_cast<LONG*>( plong ) ); }

InterlockedIncrement is defined in winnt.h as :

#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) .

Which means you actually are trying to define the _InterlockedIncrement function, which is prohibited as it's an intrinsic.

I think you need to remove

#define InterlockedIncrement _InterlockedIncrement

and make InterlockedIncrement call _InterlockedIncrement with appropriate argument conversion if needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM