I tried this way and it worked for me without having to modify the mraa source files using inline.
Instead of #including with .hpp, I.E. #include "mraa/common.hpp"
I instead included its .h file. I.E. #include "mraa/common.h"
doing this it took care of everything for me, compiled and now works just fine without any mods needed to the mraa source files using inline.
I then (but you dont have to) created a "headers.h" file. In there i have the following.
#ifndef HEADERS_H_
#define HEADERS_H_
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <stdint.h>
#include <unistd.h>
#include "mraa/common.h"
#include "mraa/spi.h"
#include "mraa/gpio.h"
extern mraa_spi_context spi;
extern mraa_gpio_context gpio;
#include "mcp23s17.h"
#define MS (1000)
#endif /* HEADERS_H_ */
Then in my main app i just have one #include "headers.h", and in my other source file that takes care of the SPI calls I put the same in there as well.
The trouble for me is that i need both source files to twiddle some I/O pins. Which is what created this whole problem in the first place.
In main, i made these global, and in my headers.h file i externed them so now all sources can use them.
mraa_spi_context spi;
mraa_gpio_context gpio;