8 years, 4 months ago.

#define MBED_PLATFORM into M2XStreamClient.h issue

Hi,

I'm trying to send data from analog sensor (STM32F746-Discovery) with online mbed compiler.

My project use M2X library, but during compilation I get <Platform definition is missing!> because: Into M2XStreamClient.h line 6, MBED_PLATFORM is not defined.

I've udated all used library.

Is there a way to define global macro in a mbed project without modify M2X library ?

Thank you.

1 Answer

8 years, 4 months ago.

My M2X code main.cpp starts off like this:

SNIP From M2X library example that works

#define MBED_PLATFORM

#include <jsonlite.h>
#include "M2XStreamClient.h"

#include "mbed.h"
//#include "EthernetInterface.h"
#include "WIZnetInterface.h"

//EthernetInterface eth;
// ST Nucleo
SPI spi(PA_7, PA_6, PA_5); // mosi, miso, sclk
WIZnetInterface eth(&spi, PB_6, PA_10); // spi, cs, reset

char deviceId[] = "<your ID needs to go here>"; // Device you want to push to
char streamName[] = "<your Stream ID goes here>"; // Stream you want to push to
char m2xKey[] = "<your M2X key goes here>"; // Your M2X API Key or Master API Key

Client client;
M2XStreamClient m2xClient(&client, m2xKey);
TimeService timeService(&m2xClient);
Serial pc(USBTX,USBRX);

I did not encounter any other issues using the example.

Accepted Answer

He might have to use compile all, but maybe not required. Alternative is to add it in the compile macros it via the compile drop down menu, but you have to put it there everytime, so this method is preferable.

posted by Erik - 24 Jun 2016