Hi. I’m trying to incorporate libbson into an Arduino project. I’d like to put all the libbson stuff into a bson/ directory alongside the sketch file, then compile & link everything in that directory with the sketch file.
I can get the sketch file itself to compile, but it looks like Arduino isn’t finding the bson/*.c files. Is there some way I can tell it to check that subdirectory?
Right now I’ve hacked it together with a bunch of symlinks, but I’d really prefer a better solution.
Along the same line: is there a way I can define a compiler directive, à la -DFOO=BAR or such such?
Please remember that C and C++ use different conventions for naming functions. To link from a C++ source file to a C library you have to tell the C++ compiler that the names use the C convention:
#extern “C” {
#include “somelib.h”
}
That’s from memory so I may be off a bit in the syntax.
You may also have to put the folder in a “src” folder in your sketch folder.