mingw STLport配合boost::thread库或gSoap时编译错误

来源:互联网 发布:tomcat mac 安装 编辑:程序博客网 时间:2024/04/30 03:01

mingw 使用STLport配合boost::thread库或gSoap时,编译时会报以下错误

原文:http://sourceforge.net/projects/stlport/forums/forum/490891/topic/3036652

                 from ../Source/./gSoap/Linux/stdsoap2.h:663,                 from ../Source/./gSoap/Linux/soapStub.h:11,                 from ../Source/./gSoap/Linux/soapH.h:10,                 from ../Source/./gSoap/Linux/Service.nsmap:2,                 from ../Source/gSoap/SoapMap.cpp:11:c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/winbase.h:1848:49: error: declaration of C function 'LONG InterlockedDecrement(volatile LONG*)' conflicts with../../../C++library/STLport/stlport/stl/config/_windows.h:109:42: error: previous declaration 'long int InterlockedDecrement(long int*)' herec:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/winbase.h:1849:53: error: declaration of C function 'LONG InterlockedExchange(volatile LONG*, LONG)' conflicts with../../../C++library/STLport/stlport/stl/config/_windows.h:110:42: error: previous declaration 'long int InterlockedExchange(long int*, long int)' herec:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include/winbase.h:1857:49: error: declaration of C function 'LONG InterlockedIncrement(volatile LONG*)' conflicts with../../../C++library/STLport/stlport/stl/config/_windows.h:108:42: error: previous declaration 'long int InterlockedIncrement(long int*)' here


 

include/winbase.h:1848:49: error: declaration of C function 'LONG InterlockedDecrement(volatile LONG*)' conflicts with
_windows.h:109:42: error: previous declaration 'long int InterlockedDecrement(long int*)' here
include/winbase.h:1849:53: error: declaration of C function 'LONG InterlockedExchange(volatile LONG*, LONG)' conflicts with
_windows.h:110:42: error: previous declaration 'long int InterlockedExchange(long int*, long int)' here
nclude/winbase.h:1857:49: error: declaration of C function 'LONG InterlockedIncrement(volatile LONG*)' conflicts with
_windows.h:108:42: error: previous declaration 'long int InterlockedIncrement(long int*)' here

 

如果使用 STLPort   Mingw API 的 Windows 版本 3.12 (或更高版本),解决方法:

如果您的 STLport 是 5.2.x,只需打开文件"stlport\stl\config\user_config.h"取消注释宏 _STLP_NEW_PLATFORM_SDK。这将帮助STLport选择正确的InterlockedXXX 函数原型。

如果您的 STLport 5.1.x,您将必须:

1.修改上面的"stlport\stl\config\user_config.h"文件。
2.在文件"stlport/stl/config/_gcc.h"中,找到以下行:

# if defined (_STLP_NEW_PLATFORM_SDK)
/* For the moment the Windows SDK coming with Mingw still mimik the old platform SDK. */
# undef _STLP_NEW_PLATFORM_SDK
# endif

然后替换为:
# include <w32api.h>

# if (__W32API_MAJOR_VERSION > 3) || ((__W32API_MAJOR_VERSION = 3) && (__W32API_MINOR_VERSION >= 12))
# if !defined(_STLP_NEW_PLATFORM_SDK)
# define _STLP_NEW_PLATFORM_SDK 1
# endif
# endif