互锁函数 - 无法转换参数

时间:2015-07-27 07:40:36

标签: visual-studio winapi cppunit interlocked

我需要在ARM平台上编译cppunit。所有编译都可以在发布模式下正常工作,但在调试模式下,我会遇到以下错误:

Error   1   error C2664: 'unsigned int CppUnit::_InterlockedIncrement(volatile unsigned int *)' : cannot convert argument 1 from 'volatile long *' to 'volatile unsigned int *' C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 8959    1   cppunit
Error   2   error C2665: 'CppUnit::_InterlockedIncrement' : none of the 2 overloads could convert all the argument types    C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 8968    1   cppunit
Error   3   error C2664: 'unsigned int CppUnit::_InterlockedDecrement(volatile unsigned int *)' : cannot convert argument 1 from 'volatile long *' to 'volatile unsigned int *' C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 8990    1   cppunit
Error   4   error C2665: 'CppUnit::_InterlockedDecrement' : none of the 2 overloads could convert all the argument types    C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 8999    1   cppunit
Error   5   error C2664: 'unsigned int CppUnit::_InterlockedExchange(volatile unsigned int *,unsigned int)' : cannot convert argument 1 from 'volatile long *' to 'volatile unsigned int *' C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 9024    1   cppunit
Error   6   error C2665: 'CppUnit::_InterlockedExchange' : none of the 2 overloads could convert all the argument types C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 9034    1   cppunit
Error   7   error C2664: 'unsigned int CppUnit::_InterlockedExchangeAdd(volatile unsigned int *,unsigned int)' : cannot convert argument 1 from 'volatile long *' to 'volatile unsigned int *'  C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 9058    1   cppunit
Error   8   error C2664: 'unsigned int CppUnit::_InterlockedExchangeAdd(volatile unsigned int *,unsigned int)' : cannot convert argument 1 from 'volatile long *' to 'volatile unsigned int *'  C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 9068    1   cppunit
Error   9   error C2665: 'CppUnit::_InterlockedExchangeAdd' : none of the 2 overloads could convert all the argument types  C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 9078    1   cppunit
Error   10  error C2665: 'CppUnit::_InterlockedExchangeAdd' : none of the 2 overloads could convert all the argument types  C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 9088    1   cppunit
Error   11  error C2664: 'unsigned int CppUnit::_InterlockedCompareExchange(volatile unsigned int *,unsigned int,unsigned int)' : cannot convert argument 1 from 'volatile long *' to 'volatile unsigned int *' C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 9123    1   cppunit
Error   12  error C2665: 'CppUnit::_InterlockedCompareExchange' : none of the 2 overloads could convert all the argument types  C:\Program Files (x86)\Windows Phone Kits\8.1\Include\winbase.h 9134    1   cppunit

我现在几天都在挣扎,我真的找不到任何解决办法。 我正在使用visual studio 2013。

1 个答案:

答案 0 :(得分:0)

进入同样的事情 - 看起来像是从命名空间中包含(在你的情况下是CppUnit)。编译器并不喜欢这样 - 确保你的#include不在所有命名空间之内。