问题
I am doing a transform work from windows to wince.
For using iostream I choose STLport5.2.1
.
I get the compile error on vs2008:
am files (x86)\windows ce tools\wce500\athenapbws\mfc\include\wcealt.h(248) : error C2084: function 'void *operator new(size_t,void *)' already has a body
2> D:\Program Files (x86)\Windows CE Tools\wce500\AthenaPBWS\include\ARMV4I../Armv4i/new(71) : see previous definition of 'new'
2>d:\program files (x86)\windows ce tools\wce500\athenapbws\mfc\include\wcealt.h(254) : error C2084: function 'void operator delete(void *,void *)' already has a body
2> D:\Program Files (x86)\Windows CE Tools\wce500\AthenaPBWS\include\ARMV4I../Armv4i/new(73) : see previous definition of 'delete'
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 *)' already has a body
2> d:\program files (x86)\windows ce tools\wce500\athenapbws\mfc\include\wcealt.h(247) : see previous definition of 'new'
2>D:\Program Files (x86)\Windows CE Tools\wce500\AthenaPBWS\include\ARMV4I../Armv4i/new(74) : error C2084: function 'void operator delete(void *,void *)' already has a body
2> d:\program files (x86)\windows ce tools\wce500\athenapbws\mfc\include\wcealt.h(253) : see previous definition of 'delete'
How can you solve the error?
回答1:
looks like you should define __PLACEMENT_NEW_INLINE - if was not already defined, here is what it does:
/* 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
回答2:
you have to add the string --rtl-static in the configuration bat. This worked on me on wince. The output name of dll will be stlport-x.5.2.dll
EDIT
I've found the issue. I was able to build stlport with /MD (DLL Multithread) look at http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/thread/fbae6f2a-4fc0-4610-a4b7-3d3d6bc6ac7e/
来源:https://stackoverflow.com/questions/11079337/wince-5-0-using-stlport-void-operator-newsize-t-void-already-has-a-body