How to add lib toAVRStudio

as I posted previously, operator new isn´t supported. I found out, that the new.h lib is missing, so I copied the lib from another compiler, but AVRStudio exites compilation with hundrets of errors (errors are in the included library new.h)

is there sproblem I can´t see? or where I can get appropriate lib? I´m desperate, thank´s for any help

Lertulo has given you some good advice in the other thread about how to avoide using “new”. But if you really want to dynamically allocate memory and then keep track of pointers, it looks like you can write your own “new” operator:

I have never tried it though so I don’t know if it will work.

In the Pololu AVR Library, we just use malloc instead of new in the few places where we need it. This is a line from PololuQTRSensors.cpp:

PololuQTRSensorsAnalog *qtr_analog = (PololuQTRSensorsAnalog *)malloc(sizeof(PololuQTRSensorsAnalog));

You should not be surprised when binary files that were compiled for a different architecture don’t work on the AVR. Compiled libraries contain machine instructions. If you want it to run on the AVR, then those instructions have to be AVR machine instructions, not some other type of instructions. Then there is also the issue of the actual library file format, which could differ between different compilers.


I see, thanks a lot