I'm trying to write a library for my LCD (parallax serial). Right now all these files are in the same folder, with the obvious exception of SoftwareSerial.
The following are the pertinent sections of my code.
Display.h
#ifndef __DISPLAY_H__
#define __DISPLAY_H__
#include "Arduino.h"
#include "C:\Program Files (x86)\Arduino\libraries\SoftwareSerial\SoftwareSerial.h"
class Display:private SoftwareSerial
{
public:
Display(uint8_t serialpin);
~Display();
void Initialize();
void DisplayOff();
void DisplayOn();
void Cls();
void Endl();
void Backspace(int num);
void BacklightOn();
void BacklightOff();
void DisplayCursor(bool newcursorstate);
void SetCustomCharacter(unsigned char data[7], int num);
void PrintCustomCharacter(unsigned int num);
bool PlayNote(Note note);
void SetSong(NoteSet* newsong);
void PlaySong();
void ClearSong();
void Print(String text);
void SetCursor(unsigned int x, unsigned int y);
private:
unsigned int pin;
NoteSet song;
bool displayoff;
bool cursorstate;
bool backlighton;
bool initialized;
unsigned short position;
};
Display.cpp
#include "Display.h"
Display::Display(uint8_t serialpin):SoftwareSerial(255, serialpin, false)
{
pin = serialpin;
initialized = false;
}
Display::~Display()
{
}
void Display::Initialize()
{
if(initialized)
{
DisplayOff();
}
song.Clear();
displayoff = true;
cursorstate = false;
backlighton = false;
position = 0;
initialized = true;
pinMode(pin, OUTPUT);
digitalWrite(pin, HIGH);
begin(9600);
delay(100);
write(21);
delay(50);
print("Hi");
}
main
#include "Display.h"
Display output(6);
void setup()
{
}
void loop()
{
}
I get the following error when I run it -
Display.cpp.o: In function ~Display': C:\Users\Marc\AppData\Local\Temp\build3799388810297311009.tmp/Display.cpp:13: undefined reference to
SoftwareSerial::~SoftwareSerial()'
Display.cpp.o: In function Display': C:\Users\Marc\AppData\Local\Temp\build3799388810297311009.tmp/Display.cpp:5: undefined reference to
SoftwareSerial::SoftwareSerial(unsigned char, unsigned char, bool)'
Display.cpp.o:(.rodata._ZTV7Display+0x4): undefined reference to SoftwareSerial::write(unsigned char)' Display.cpp.o:(.rodata._ZTV7Display+0x8): undefined reference to
SoftwareSerial::available()'
Display.cpp.o:(.rodata._ZTV7Display+0xa): undefined reference to SoftwareSerial::read()' Display.cpp.o:(.rodata._ZTV7Display+0xc): undefined reference to
SoftwareSerial::peek()'
Display.cpp.o:(.rodata._ZTV7Display+0xe): undefined reference to `SoftwareSerial::flush()'
If I take out the "Display output(6);" line, it compiles fine. I also ported the code to visual C++ and it had no problem if I commented out the pertinent arduino specific commands.
Please help?