9 years, 10 months ago.

How to set include search paths and #defines to be used by the mbed.org compiler?

If I have a program that has #ifdefs how can I tell the mbed.org compiler what #define to use (eg., equivalent of the -D gcc option)?

Also, what is the equivalent of the -I gcc option, to specify include search paths?

1 Answer

9 years, 10 months ago.

These options are not exposed when using the online IDE. You'd need to create a *.inc file and use in source as appropriate.

test.inc

#define LABEL 3


main.cpp

#include "test.inc"

#if LABEL == 1
#error LABEL is 1
#else
#warning LABEL is not 1
#endif

Accepted Answer