I can't this to work. My sketch is:
#include "sub/mydriver.c"
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
myfunc(2);
}
sub/mydriver.c :
int myfunc (int a)
{
return a*a;
}
The compiler output is :
C:\Programs\arduino-1.5.2\hardware\tools\avr\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=atmega1280 -DF_CPU=16000000L -DARDUINO=152 -IC:\Programs\arduino-1.5.2\hardware\arduino\avr\cores\arduino -IC:\Programs\arduino-1.5.2\hardware\arduino\avr\variants\mega C:\Users\bob\AppData\Local\Temp\build2805575431420087737.tmp\sketch_feb16b.cpp -o C:\Users\bob\AppData\Local\Temp\build2805575431420087737.tmp\sketch_feb16b.cpp.o
sketch_feb16b.ino:2:26: error: sub/mydriver.c: No such file or directory
sketch_feb16b.ino: In function 'void loop()':
sketch_feb16b:11: error: 'myfunc' was not declared in this scope
Using Arduino 1.5.2. I am doing something dumb?
ETA: I though that using chevron quotes #include <sub/mydriver.c> was finding the file but not compiling it, but in fact the include is ignored completely, and doesn't complain about missing files.
ETA2: Yes, I realize the above is from the AVR compiler, but the same applies for the ARM compiler. See below