我添加了 _AFXDLL 宏并得到以下两个错误:
error C2039: 'InterlockedAdd64': is not a member of '`global namespace''
error C3861: 'InterlockedAdd64': identifier not found
原因是什么以及如何解决该问题?
我在尝试为使用 MFC 的 DLL 添加 c++/clr 支持时遇到了这个问题。
如果我想使用 clr 支持,看起来我很不走运:
MSDN: _MANAGED 在设置 /clr 编译器选项时定义为 1。否则,未定义。
来自 winnt.h:
#if !defined(_MANAGED)
#if (_MSC_VER >= 1600)
...
FORCEINLINE
LONG64
_InterlockedAdd64 (
_Inout_ _Interlocked_operand_ LONG64 volatile *Addend,
_In_ LONG64 Value
)
{
...
}
#define InterlockedAdd64 _InterlockedAdd64
...
#endif // !defined(_MANAGED)