Arm Mbed and Pelion Device Management support forum

How can my library detect when it is being compiled using the mbed [online] compiler?

I test imported one of my libraries from github, which went fine, but I would like to configure it for MBED CLI/ MBED online compiler, so that it works straight away without modifications. (Meanwhile I had to create a #define MBED_ONLINE_COMPILER and put that in a config.h file to configure my library)

I would like for example to disable exceptions and RTTI automatically when using mbed online compiler. Is there a define that can be used to detect that I am compiling under MBED CLI/ MBED online compiler

e.g like _linux_ _WIN32 etc ?

Thankyou.

Hello Andy,

I think generally you can test for __MBED__ .
If you’d like to know which version
MBED_VERSION
MBED_MAJOR_VERSION
MBED_MINOR_VERSION
MBED_PATCH_VERSION
MBED_VERSION_CHECK
could be handy. For more details have a look at “mbed-os\platform\mbed_version.h

1 Like