error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed

MSVC 2005 has bugs when including <intrin.h>.

Second linkage error

If you get the following errors:

error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed

error C2733: second C linkage of overloaded function '_interlockedbittestandreset' not allowed

They happen when both <intrin.h> and <windows.h> are included in the same file.  One way to get around it is to define a rename for these functions before including intrin.h. E.g.:

#if _MSC_VER <= 1400
#define _interlockedbittestandreset _interlockedbittestandreset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#define _interlockedbittestandset _interlockedbittestandset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR
#endif
Unresolved external for intrinsic function

If you get the following or a similar linker error when using an intrinsic function such as _ReadBarrier, _WriteBarrier, _ReadWriteBarrier, etc.

error LNK2019: unresolved external symbol __ReadWriteBarrier referenced in function

You need to explicitly declare the function as intrinsic (even if you included <intrin.h>). E.g.:

#pragma intrinsic(_ReadWriteBarrier)

See here: http://connect.microsoft.com/VisualS...details/100051

 

reference:http://blog.assarbad.net/20120425/annoyance-in-the-windows-sdk-headers/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值