Skip to content

TestHarness.h - Compile errors in C++ headers unless #include <memory> is added #1827

@sktpin

Description

@sktpin

I don't know whether I forgot to define something or not.
As I'm using CppUTest on a baremetal ARM Cortex-M target, built as a separate project / static library, which my main project then links, and includes headers of.

In the project using the lib, when I #include "CppUTest/TestHarness.h" in a test.cpp file which then uses macros like TEST_GROUP etc, I get the following error, and other errors about C++ std stuff not knowing about other std stuff in many repetitions:

arm-none-eabi/include/c++/13.3.1/new:126:26: error: declaration of 'operator new' as non-function

Using ARM GCC 13.3.1.

If I put before including TestHarness.h:
#include <memory>

everything works. The program with the tests executes as expected on my emulator target(1), the executable size looks normal.
My program has, for the C++ compiler, these global defines:

CPPUTEST_STD_CPP_LIB_DISABLED
CPPUTEST_STD_C_LIB_DISABLED
CPPUTEST_CHAR_BIT=8
CPPUTEST_HAVE_FENV=0
CPPUTEST_HAVE_GETTIMEOFDAY

(1) I'm using Renode, if anyone is curious - not quite as sluggish as QEMU, and has a simulated UART where I can see CppUTest's text output, e.g. in a Telnet console.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions