AnsweredAssumed Answered

undefined reference to operator new

Question asked by Aaron Minner on Jan 22, 2019
Latest reply on Jan 22, 2019 by Alice_Yang

Using MCUXpresso with SDK 2.5.0 for the K66 processor.  Started with a C project that I got to compile, link and execute on the hardware just fine. Added a C++ file to provide support for an external device (SI5351A clock chip).  Updated the build process, since it doesn't consider C++ files automatically.  Resolved the few syntax errors involved in calling C++ from C.  So far, so good.  However, in the link stage, I get the following error:

 

> ... undefined reference to `operator new(unsigned int)'

 

If I follow the advice from the Internet and add "stdc++" to the link options, I get a list of errors related to exceptions.  If I try to add other linkage options to resolve those, I get additional errors.  I did clean the project at various stages and build fresh; doesn't seem to make a difference.

 

Am I overlooking something in incorporating C++ from within a C project in MCUXpresso?

Outcomes