Undefined reference to 'operator new(unsigned int, void*)'

I have created several C++ classes for Arduino, and in my design, a pointer to the object of one class is passed as a parameter to the constructor of another class. I am also using the STL library, ported by Andy Brown. To facilitate the process of constructing objects, I am trying to dynamically allocate objects to a pointer of arrays. However, the compiler gives me an undefined reference error to using the ‘new’ operator.

I am able to use the new operator on primitive data types, but the compiler will not let me on the C++ classes I’ve written myself.

//Dynamically allocate 10 ServoJoint objects
    for(size_t i=0; i<10; i++){
        servoJoints[i]= new ServoJoint(i, 7, calibrationArrays[i]);

I saw someone suggesting the use of this code:

void * operator new[] (size_t size) { return malloc(size); }
void operator delete[] (void * ptr) { free (ptr); }

But this results in additional errors: “new.cpp.o (symbol from plugin): In function ‘opreator new(unsigned int)’: (text+0x0): multiple definitions of ‘operator new(unsigned int)’, (symbol from plugin):(.text+0x0)”

If you can not use new, you have introduced some error,
which is impossible to find without a small example that shows the claimed behaviour.

Here you have a simple example of a perfectly working new example

class Test {
    int value;
    Test(int val) : value(val) {}
    void print() {
      Serial.print(F("Value is "));

void setup() {
  Test* test = new Test(1234);
  delete test;

void loop() {}
Value is 1234