配置环境时出现如下问题:
error C2733: second C linkage of overloaded function 'InterlockedIncrement' not allowed
error C2733: second C linkage of overloaded function 'InterlockedDecrement' not allowed
error C2733: second C linkage of overloaded function 'InterlockedExchange' not allowed
经排查,原因是PSDK的WinBase.h定义的线程安全函数InterlockedIncrement、InterlockedDecrement、InterlockedExchange跟STLport中_threads.h内定义的函数起冲突引发的错误。
直观的解决办法是到定义这些宏的地方去,为其进行ifelse的判断
但STLport已经为兼容做了准备,在stlprot\stl\config\user_config.h中,有如下一处宏定义
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
/* * You should define this macro if compiling with MFC - STLport <stl/config/_windows.h> * then include <afx.h> instead of <windows.h> to get synchronisation primitives */ /* #define _STLP_USE_MFC 1 */ /* * boris : this setting is here as we cannot detect precense of new Platform SDK automatically * If you are using new PSDK with VC++ 6.0 or lower, * please define this to get correct prototypes for InterlockedXXX functions */ /* #define _STLP_NEW_PLATFORM_SDK 1 */
将这两个宏定义起掉,就完美解决了这个问题