x_boot

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

配置环境时出现如下问题:

  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中,有如下一处宏定义

/*
 * 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
*/
View Code

将这两个宏定义起掉,就完美解决了这个问题

 

 

 

posted on 2013-11-22 14:44  x_boot  阅读(2676)  评论(0编辑  收藏  举报