MSVC 2005は<intrin.h>をインクルードしたときにバグを発生します。
第二リンケージエラー
もしあなたが下記のエラーに遭遇した時:
error C2733: second C linkage of overloaded function '_interlockedbittestandset' not allowed
error C2733: second C linkage of overloaded function '_interlockedbittestandreset' not allowed
これはintrin.h と windows.hが同じファイルでインクルードされた場合に発生します。回避する方法の一つとしてintrin.hをインクルードする前にそれらの関数名を再定義する方法です。 例:
#if _MSC_VER <= 1400 #define _interlockedbittestandreset _interlockedbittestandreset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR #define _interlockedbittestandset _interlockedbittestandset_NAME_CHANGED_TO_AVOID_MSVS2005_ERROR #endif
外部の組み込み関数が未解決
もし_ReadBarrier, _WriteBarrier, _ReadWriteBarrierなどの組み込み関数を使用した場合、次のようなリンカのエラーに遭遇するかもしれません。
error LNK2019: unresolved external symbol __ReadWriteBarrier referenced in function
あなたが<intrin.h>をインクルードしたときに明示的に組み込み関数を宣言する必要があります。例:
#pragma intrinsic(_ReadWriteBarrier)
ここを参照してください: http://connect.microsoft.com/VisualS...details/100051