math_Matrix variable

HI
How can I make a math_Matrix A(a,b,c,d) as a global variable and
then set the variables a, b, c and d.
Thanks for any response

Olivier Coma's picture

By using a pointer, it should be ok.

math_Matrix* pMatrix=NULL;

#define myMatrix (*pMatrix)

void doSomething();

void main()
{
int a=1,b=4,c=1,d=4;
pMatrix=new math_Matrix(a,b,c,d);
doSomething();
delete pMatrix;
}

void doSomething()
{
(*pMatrix) *=2.0;
//or
myMatrix*=2.0;
}

Alex's picture

Dear sir,
Thank you and sorry for late.
I use it,in OCC samples it works but it doesnt work on my new project and "pMatrix=new math_Matrix(a,b,c,d);" makes the following error:

error C2661: 'new' : no overloaded function takes 3 parameters
Error executing cl.exe.

Is there another definition need?

Patrik Mueller's picture

Hi Alex,

if you develop with VC try commenting out the following block:

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

HTH,

Patrik