All Forums
 Microsoft Windows CE
 eVC Application Development
 CMap warning when storing structs
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Author Topic  

2746

13 Posts

Posted - 31 Aug 2004 :  18:07:49  Show Profile  Email Poster
I'm trying to create a CMap that stores three different types of messages that I recieve from a number of sources. I am using a CMap because I will have a large number of sources and need to search the list using a unique identifier for each source. The struct contains 3 CString variables to store the variable length messages.

Source Code:
struct SMessage
{
CString m_sMessage1;
CString m_sMessage2;
CString m_sMessage3;
};

class CMessageMap
{// Other stuff here

CMap MessageMap;

// More stuff here
};

When I try to compile I get the following warning:
...afxtempl.h(74) : warning C4291: 'void *__cdecl operator new(unsigned int,void *)' : no matching operator delete found; memory will not be freed if initialization throws an exception

What I can't figure out is where to add a delete operator. It looks like the new() function is defined in iabitsyx\mfc\include\wcealt.h(244) but there isn't a delete function. Any clues? I'm not sure I want to edit MFC include files.

(I'm using eVC 4.0)

Thanks,
Kevin

2746

13 Posts

Posted - 31 Aug 2004 :  20:12:51  Show Profile  Email Poster
I think I have this figured out. The MGC include files claim there isn't a in Win CE (even though there is one in the include folder). So they put the following definition in afxtemp.h

// There is no new.h for WinCE, so we define a placement new here.
inline void * operator new(size_t, void * ptr)
{
return ptr;
}

However, they never define a delete() that corresponds. Looking in new.h the following is defined:

inline void *__cdecl operator new(size_t, void *_P)
{return (_P); }
#if _MSC_VER >= 1200 /*IFSTRIP=IGN*/
inline void __cdecl operator delete(void *, void *)
{return; }
#endif

But for some reason eVC/WinCE doesn't include so I copied the delete function to be global in my MessageMap.h file and it suddenly compiles without complaint.

Seems like this is a bug in the include files for the platform I'm using. The files are in the following directory: "Windows CE Tools\wce410\IABITSYX\Include\Armv4i\"
Go to Top of Page

akidder

1519 Posts

Posted - 08 Sep 2004 :  11:32:21  Show Profile  Email Poster
Thanks for pointing this out and for sharing your workaround. This might be the kind of item that Microsoft will patch with a QFE someday.
Go to Top of Page
  Topic  
 Forum Locked
 Send Topic to a Friend
 Printer Friendly
Jump To:
Eurotech Support Forums © Eurotech Inc. Go To Top Of Page
This page was generated in 0.02 seconds. Snitz Forums 2000