Archived

This topic is now archived and is closed to further replies.

Strange MSVC.NET error

This topic is 5515 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Using VC++ 7.0, does anyone know why I get this error constructing an object like this:
    
// Init Open CASCADE graphic device

m_myGraphicDevice = new Graphic3d_WNTGraphicDevice();
// recieve this error, I haven't got 3 params in this line!!!

// occurs under debug configuration, but not release config

// c:\...cpp(39): error C2661: 'Graphic3d_WNTGraphicDevice::operator new' : no overloaded function takes 3 parameters

    
Any help appreciated! [EDIT] I don't know if it helps, but the class does contain some operator new's [edited by - NickB on November 10, 2002 4:17:10 PM]

Share this post


Link to post
Share on other sites
No; I seem to have got arround it by explicitly using new in the global scope, ie:


    
// Init Open CASCADE graphic device

m_myGraphicDevice = ::new Graphic3d_WNTGraphicDevice();


Strange that this only happens in the debug build...but there you go!

[edited by - NickB on November 11, 2002 10:45:42 AM]

Share this post


Link to post
Share on other sites
msvc has the debug heap which is active in debug builds if you''re using mfc, atl or <crtdbg.h>. when it''s active, operator new is mapped to a special debug operator new that provides additional debug info, namely source file and line number of the allocation. try adding the following dummy new overload to your class:

#ifdef _DEBUG
void *operator new(size_t amount, const char *file, int line)
{ return operator new(amount); }
#endif

you may want to read up on msvc''s debug heap and possibly reconsider the use of your custom operator new in debug builds.

Share this post


Link to post
Share on other sites
Interesting! Neither of these things work - it's a little bizzare, because initially it did compile in debug mode, and I did nothing that could have affected it, when it took a sudden dislike to me!

Unfortunatelly, I'm using an open source component, meaning I don't really want to remove custom new operators from it! That said I quite like the component (Open CAS.CADE) which provides the framework for CAD type applications (including visulisation) - might be useful for creating game editing tools if you're interested.

[edited by - NickB on November 13, 2002 7:03:17 AM]

Share this post


Link to post
Share on other sites