need help using the avr-g++ compiler instead of using the IDE

pert:
The Arduino IDE automatically adds this line to your sketch:

#include <Arduino.h>

Did you add that line to your code?

Absolutely, was the first thing I did.