Question
Hard Fault error while using NEW operator in cpp
Posted on June 19, 2018 at 12:10
Hi All,
I'm working on STM32L4 MCU in CPP project(cubeMX code that c code i convert to cpp), i have one doubt in NEW operator, i create array of pointer object and i build code no error but while debugging i got Hard Fault error .
code:
header.h:
class cRcdMaker
{protected:
cRecorder* mRecorders[3 ]; //
cRecorder class
};code.cpp:
for ( i = 0; i < mNumSimultaneousRecorders; i++ )
{ mRecorders[1] = new cRecorder(); }