My sketch (foo) includes a class (bar) which is in the libraries folder. Foo and Bar both include FooBar.h which is located in the same directory as Foo. Unfortunately, this doesn't always work. What happens when I compile is:
Bar.h: : fatal error: FooBar.h: No such file or directory
#include "FooBar.h"
compilation terminated
An Error was encountered during the "Deep Search" library discovery process.
Here is the code:
// Foo.ino
#include <Bar.h>
#include "FooBar.h"
Bar *bar;
void setup() {
Serial.begin(115200);
bar = new Bar();
bar->init();
}
void loop() {}
<<<<<<<<<<<<<<<>>>>>>>>>>>>>>
// Bar.h
#ifndef _BAR_h
#define _BAR_h
#include "arduino.h"
#include "FooBar.h"
class Bar
{
public:
Bar();
void init();
};
#endif
<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>
// Bar.cpp
#include <Bar.h>
Bar::Bar() {}
void Bar::init()
{
Serial.print("Bar class initialized");
}
<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>
// FooBar.h
#ifndef _FOOBAR_h
#define _FOOBAR_h
#include "arduino.h"
#define FOOBAR true
#endif
My goal is to have multiple instances of Foo, each of which has a different version of FooBar, with all instances using a version of Bar which is compiled with different options that are selected using "define" statements in FooBar. To accomplish this, Bar must be able to include a version of FooBar from the same folder that contains Foo.ino.
Ideas?