Wince 5.0使用STLport void * operator new(size_t,void *)'已经有一个正文

时间:2012-06-18 08:35:29

标签: visual-c++ windows-ce stlport

我正在进行从windows到wince的转换工作。 要使用iostream,请选择STLport5.2.1。 我在 vs2008 上得到了编译错误:

  

am files(x86)\ windows ce tools \ wce500 \ athenapbws \ mfc \ include \ waltalt.h(248):error C2084:function'void * operator new(size_t,void *)'已经有一个正文

     

2 - ; D:\ Program Files(x86)\ Windows CE Tools \ wce500 \ AthenaPBWS \ include \ ARMV4I ../ Armv4i / new(71):参见先前对'new'的定义

     

2> d:\ program files(x86)\ windows ce tools \ wce500 \ athenapbws \ mfc \ include \ wcealt.h(254):错误C2084:函数'void operator delete(void *,void *)'已经有一个身体

     

2 - ; D:\ Program Files(x86)\ Windows CE Tools \ wce500 \ AthenaPBWS \ include \ ARMV4I ../ Armv4i / new(73):参见先前的'delete'定义

     

2 - ; Util1.cpp   2> D:\ Program Files(x86)\ Windows CE Tools \ wce500 \ AthenaPBWS \ include \ ARMV4I ../ Armv4i / new(72):错误C2084:函数'void * operator new(size_t,void *)'已经有身体

     

2 - ; d:\ program files(x86)\ windows ce tools \ wce500 \ athenapbws \ mfc \ include \ wsalt.h(247):参见先前对'new'的定义

     

2> D:\ Program Files(x86)\ Windows CE Tools \ wce500 \ AthenaPBWS \ include \ ARMV4I ../ Armv4i / new(74):错误C2084:function'void operator delete(void *,void *) '已经有一个身体

     

2 - ; d:\ program files(x86)\ windows ce tools \ wce500 \ athenapbws \ mfc \ include \ wsalt.h(253):参见先前的'delete'定义

如何解决错误?

2 个答案:

答案 0 :(得分:1)

看起来你应该定义__PLACEMENT_NEW_INLINE - 如果还没有定义,这就是它的作用:

/* Workaround when using MFCCE and using  together: MFCCE's wcealt.h doesn't
 * check for __PLACEMENT_NEW_INLINE before defining operator new, so when 
 * defines the operatore before, there will be an error C2084:
 * "function 'void *__cdecl operator new(unsigned int,void *)' already has a body".
 */
#  ifdef _STLP_USE_MFC
#    define __PLACEMENT_NEW_INLINE
#  endif

答案 1 :(得分:1)

你必须在配置bat中添加字符串--rtl-static。 这对我很有帮助。 dll的输出名称为stlport-x.5.2.dll

修改

我发现了这个问题。我能够用/ MD(DLL Multithread)来构建stlport http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/fbae6f2a-4fc0-4610-a4b7-3d3d6bc6ac7e/