For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings


Need to speed up your development?
Have a look at our:

Samples & Tools


Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Compilation problem (Windows)

Anonymous's picture

Hi !

I am trying to put together a small app using Open CASCADE, similar to the MFC viewer3d demo.

I can compile the viewer3d demo without problems, even though it complains alot about:

V:\msdev\project\cascade\samples\viewer3d\SampleViewer3d.cpp(37) : warning C4291: 'void *__cdecl Graphic3d_WNTGraphicDevice::operator new(unsigned int)' : no matching operator delete found; memory will not be freed if initialization throws an except ion

Is this normal ?

But when I try to compile my own application, it's as close as the viewer3d app I can get, it complains on this line:

myViewer = new V3d_Viewer( theGraphicDevice, (short *) "Visu3D");

The error is: V:\msdev\project\castest\DocTest.cpp(33) : error C2661: 'new' : no overloaded function takes 3 parameters

But I only get this when I compile in DEBUG mode, I have compared all defines and so on with the viewer3d sample and I cannot find any difference, the viewer3d demo app works so I am doing something wrong, but what, does any one have a clue ?


Mikael Aronsson's picture

Hi !

Please igone my previous posting about compilation problems, I should learn how to read.


Mikael Aronsson's picture

Hi !

Hmmm, I thought I fixed it, but I still have the same problem, when this line is compiled (or any other line with "new cascacde_class_something"):

myViewer = new V3d_Viewer( theGraphicDevice, (short *) "Visu3D");

I get this error when I compile with debugging:

error C2661: 'new' : no overloaded function takes 3 parameters

This has something to do with the fact that MFC overloads new, if I put a #define _AFX_NO_DEBUG_CRT it compiles, but that is no solution, because this does not link.

I have compared my .dsp file with the one for the viewer3d example and I cannot find any difference, all options are the same, but the viewer3d compiles ok.

I use VC++ 6.0.

Am I the only one that have problems with this ?


Stephane Routelous's picture


the reason is that in debug mode, the "new" operator is overloaded by MFC ( for debug purpose ).

But Cas.Cade overload the new operator in the "Handled" classes , because of the reference counter included in the Smart Pointer class ( MMgt_TShared ).

You cannot use the "debug" new operator from Microsoft with the cascade classes ( I think it is a macro defined somewhere in the MFC code ).

The CasCade overloaded new operator is also a reason why you can not use multiple inheritance with Cas.Cade.

To avoid this problem, you can just remove the #define new DEBUG_NEW

It should works.

By the way, you should remove the "_DEBUG" preprocessor definition, in order to be able to debug your application with Cas.Cade without problems.

Best Regards,


bailly's picture

Thank you very much, I lose 4 hours because of this problem.

Best Regards,


shmsh's picture

Regards Dear

Great solution .... You saved my time

Thanks a lot