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

Hi everyone,

I tring to do my first OCC project by new. I copied preprocessor dirctives from mfc samples but I always get

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

in, for example, "new V3d_Viewer". In general in every new Handle statement.

What I'm missing ?

Thankyou in advance

Ezio

Tilman Leune's picture

I started of using the c#-Example, but transcoded it to a c++ - Dll.

The initialization of mine looks like this:

TCollection_ExtendedString a3DName("Visu3D");
myViewer = new V3d_Viewer( myGraphicDevice, a3DName.ToExtString(),"", 1000.0,
V3d_XposYnegZpos, Quantity_NOC_GRAY30,
V3d_ZBUFFER,V3d_GOURAUD,V3d_WAIT,
Standard_True, Standard_False);

And works flawlessly for me.

Do you include v3d_viwer.hxx?
And do you link against TKV3d.lib?

The samples make use of the stdafx.h for inclusion of header files, so maybe you do include a stdafx.h into your project, but hte required header files are not included from there?

Just a few random thoughts of mine, hope they help you.

Arjan Schouten's picture

Hello Ezio,

This is caused by the overloaded new operator for MFC debug builds
Try commenting out the following lines in your source file(s)

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

I have been bitten by it a few times in the past.

Arjan.

ezio.endrigo's picture

Hi Arjan,

thanks so much. Your suggestion solved my problem.

Ezio