9 years, 6 months ago.

mbed preprocessor definition

Does mbed have a preprocessor definition? I tried MBED, _MBED and _ _MBED, but none of them are defined.

For example.

  #ifned MBED
  //This code is not compiled for mbed builds
  #endif

(I have no idea why I can't get that code block to work, and I'm not going to mess with it more after half a dozen tries)

Thanks.

1 Answer

9 years, 6 months ago.

Code tags need to be on their own line, otherwise they do not work.

__MBED__

Exists and is added by the build system (also when you export). In general you can export a project and see which defines are added. The library itself sets MBED_H and MBED_LIBRARY_VERSION (with a number).

Accepted Answer

Thank you, that was what I'm looking for.

Regarding the code tags, the opening and closing tags are on their own lines. I've used them several times before and have never had this problem.

posted by Dan East 29 Nov 2014

Closing code tag had two slashes.

posted by Dan East 29 Nov 2014