I am writing a test using GoogleTest for the following class and I am getting the above error.
class Base
{
// Other Functions;
CSig objSig[50];
}
The Class CSig is as follows:
class CSig
{
//... constructor, destructor(empty) and some functions
CMod *objMod;
CDemod *objDemod;
}
CSig :: CSig
{
bIsInitialised = false;
for (int i=0; i<MAX_NUM; i++)
{
PStrokePrev[i] = 0.0;
}
}
However, when I discard CSig objSig[50]
, the tests run fine.
What can I do to solve this issue? Also, I need to have CSig objSig[50]
in the Base class.
0xc0000005
is access violation. You need to show us more code (CSig
's constructor/destructor possibly). – ExpressCSig
– PeanutsPStrokePrev
and does it have space forMAX_NUM
doubles? – TenementPStrokePrev
is an array of type double and it does have space forMAX_NUM
. – PeanutsPStrokePrev
declared? Is it dynamically allocated and has it been created before theCSig
constructor is called? Why doesn't your constructor initializeobjMod
orobjDemod
? The source of the error isn't obvious from the small code snippet you've posted. I'm just pointing out a possible array overrun and uninitialized pointers that could cause the fault. – Tenement