So, I create a folder inside my libraries folder and add some classes. So far so good, I can #include the header and instantiate whatever class I've made.
BUT, if I would appear to be unable to include another class within my own classes.
Here's a rather frivolous cut down example :
|=========================
pigDebug.h
|=========================
- Code: Select all | TOGGLE FULL SIZE
#ifndef __pigDebug__
#define __pigDebug__
#include "AFSoftSerial.h"
class pigDebug :public AFSoftSerial
{
public:
pigDebug(int rx,int tx);
void start(long baud);
void out(char* msg);
};
#endif
|=========================
pigDebug.cpp
|=========================
- Code: Select all | TOGGLE FULL SIZE
#include "pigdebug.h"
#include "hardwareserial.h"
pigDebug::pigDebug(int rx,int tx)
:AFSoftSerial(rx,tx)
{
}
void pigDebug::start(long baud)
{
begin(baud);
}
void pigDebug::out(char* msg)
{
print(msg);
}
Attempting to include this in a test project gives me :
hardware\libraries\pigtools/pigdebug.h:3:26: error: AFSoftSerial.h: No such file or directory
I can force the compiler to see AFSoftSerial.h by changing my #include to
''#include "../AFSoftSerial/AFSoftSerial.h", which allows me to compile ok, but it looks like the compiler is unable to track down the .cpp code, since when I attempt to upload to my arduino I get the following error :
\pigdebug.cpp:14: undefined reference to `AFSoftSerial::print(char const*)'
I can make the problem go away for a self contained library like AFSoftSerial, by copying AFSoftSerial.h and .cpp into my own library folder, but that's kind of defeating the reusability that I'm looking for in a class. And when I attempt to create a class which requires, for example, wire.h there are dependencies that get lost in the move. I'd end up re-creating everthing for every library I make. That can't be right!
Am I pushing for too much from the IDE? Have I missed something obvious?
Scott