this "error" was discovered on the Arduino IDE 2.0.0 rc6
i have written example libraries like so:
//.INO
#include <foo.h>
Foo foo;
void setup()
{
Serial.begin(9600);
}
void loop()
{
foo.foo(1);
}
//FOO.h
#ifndef FOO_H
#define FOO_H
class Foo
{
public :
void foo(int);
};
#endif
//FOO.cpp
#include <Foo.h>
#include <Arduino.h>
void Foo::foo(int i)
{
Serial.println(i);
}
both the header and the C++ source file are located in the directory:
C:\Users\*****\Documents\Arduino\libraries\foo\foo.h
C:\Users\*****\Documents\Arduino\libraries\foo\foo.cpp
my project will scale a bit, so i would like to move both the header & C++ source file to a subdirectory like so:
Arduino
|---libraries
|---foo
|---src
|---foo.h
|---foo.cpp
NOTE THE ADDED SRC
DIRECTORY
i have made acording changes to my files:
//.INO
#include "C:\Users\*****\Documents\Arduino\libraries\foo\foo\foo.h"
Foo foo;
void setup()
{
Serial.begin(9600);
}
void loop()
{
foo.foo(1);
}
//FOO.h
#ifndef FOO_H
#define FOO_H
class Foo
{
public :
void foo(int);
};
#endif
//FOO.cpp
#include "C:\Users\*****\Documents\Arduino\libraries\foo\foo\foo.h"
#include <Arduino.h> //do i have to change this to the exact file path? then where is the Arduino.h located?
void Foo::foo(int i)
{
Serial.println(i);
}
NOTE THE CHANGE TO THE INCLUDE
LINE
but the compiler is trowing at the the following error:
undefined reference to `Foo::foo(int)'
to recap; the question I am asking is, how can I run header and C++ source files from a subdirectory