Hi, I am using CodeBlocks with the AVR template. I want to add Serial.print to my program, so I include HardwareSerial.h. CB finds the include library, but then flags an error on the Serial.begin(9600); statement saying "Undefined reference to Serial". It then flags another error saying "undefined reference to `HardwareSerial::begin(unsigned long, unsigned char)'". So it finds the #include library (and I can display it by right-clicking and selecting "open include library"). So why is it telling me Serial.begin is not valid? Apologies if this is a really dumb question, but I'm really stuck on this.
Here's the code.
#include </usr/lib/avr/include/inttypes.h> // otherwise wrong inttypes.h included
#include <HardwareSerial.h>
#include <Arduino.h>
#include <avr/io.h>
#include <stdio.h>
int main(void) {
Serial.begin(9600) ;
return 0;
}
I'm using Linux Mint 18.2 and CB version 16.01.
All advice gratefully accepted.