New operator doens't work... error with [underfined reference]

Good day guys,

i have run out of idea and find no luck to get the solution from google.

Please advise me for below.

I tried to build a linked list in arduino by referring to other c++ tutorial sample code.

#include <node.h>
void setup(){
  node *root;

  for (int i=0; i<=5; i++){

     root = new node;
     root->num = 5;
     root->link = p;
     p =root;

void loop(){

It doesn’t compiled and prompt error message :
undefined reference to 'operator new (unsigned int)…

Please advise as the same logic is compiled in other c++ ide.

What is the thing i have missed out here.

Many thanks.

What version of the IDE are you using? Operator new should be there for 1.0.

thank you for your reply…

I am using Arduino 0022.

Hmm but my last try give me luck here.

I found the threat.

and adding below

#include <stdlib.h> // for malloc and free
void* operator new(size_t size) { return malloc(size); }
void operator delete(void* ptr) { free(ptr); }

after the setup and loop function solved the problem.

so is it because the arduino IDE i m using doesn’t support the new operator?

Many thanks!

The implementation doesn't include it. Looks like you found the answer. They included it in IDE 1.0.

root=new node(number);

You missed the number and parentheses.