2012-06-18 119 views
1

我正在做一个从windows到wince的转换工作。 对于使用iostream我选择STLport5.2.1。 我得到VS2008编译错误:Wince 5.0使用STLport void * operator new(size_t,void *)'已经有一个body

时许文件(x86)\ Windows CE的工具\ wce500 \ athenapbws \ MFC \包括\ wcealt.h(248):错误C2084:函数“void *运营商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):error C2084:function'void operator delete(void * ,void *)'已经有一个body

2> d:\程序文件(x86)\ Windows CE的工具\ wce500 \ AthenaPBWS \包括\ ARMV4I ../ ARMV4I /新(73):看到的 '删除' 以前的定义

2> Util1 .cpp 2> D:\ Program Files(x86)\ Windows CE Tools \ wce500 \ AthenaPBWS \ include \ ARMV4I ../ Armv4i/new(72):error C2084:function'void * operator new(size_t,void *) “已经有一个身体

2> d:\程序文件(x86)\ Windows CE的工具\ wce500 \ athenapbws \ MFC \包括\ wcealt.h(247):看前面的定义 '新'

2> D:\ Program Files(x86)\ Windows CE工具\ wce500 \ AthenaPBWS \ include \ ARMV4I ../ Armv4i/new(74):error C2084:function'void operator delete(void *,void *)'has has a body

2> d:\ program files( (253):请参阅先前定义的'删除'

如何解决错误?

+1

编译Windows CE 5.0时需要VS2005或VS2008。两者都带有用于Windows CE的STL版本。当你只需要iostream时,为什么不使用这个STL实现? – harper

回答

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 
+0

我试图在中定义或取消__PLACEMENT_NEW_INLINE,但似乎无效。 – Pat

+0

事实上,当我将#ifdef _STLP_USE_MFC#define __PLACEMENT_NEW_INLINE #endif添加到wcealt.h时,编译错误降低到2,并且中的相应代码变灰。为什么编译器仍然告诉我错误C2084:function'void * operator new(size_t,void *)'已经有一个主体 – Pat

+0

你不应该修改wcealt。h,在包含任何stl头文件之前放置任何stlport配置宏,或者更好地在stlport \ stl \ config \ user_config.h中输入 – marcinj

1

你必须添加字符串--rtl静态配置中的蝙蝠。 这对我工作wince。 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/

相关问题