Online Compiler is ignoring MACROS

17 Aug 2018

With the last update, the IDE had stop working as expected, the defined MACROS are being ignored by the compiler.

21 Aug 2018

Hi Ignacio,

Could you please tell me which macros you are trying to use?

Thank you!

- Jenny, team Mbed

24 Aug 2018

Hi Jenny,

Im using custom MACROS for my application for example:

/media/uploads/icarballeda/selection_086.png

And, then in my code :

using macros

#ifdef USE_CO2
      #include "co2.h"
#endif

But, when compiling the code the co2.h file is never included. I also tried use #warn with a message inside of the "ifdef" expression but the message never appear in the online-compiler log console, so i understand that the compiler is ignoring these macros.

Thanks in advance for your help.

24 Aug 2018

Hi Ignacio,

We're sorry this has stopped working for you! We conducted a quick test on a small project for the nRF52840 and see the defined macro being observed as this builds okay:

#include "mbed.h"

#ifdef USE_LED
DigitalOut led1(LED1);
#endif

// main() runs in its own thread in the OS
int main() {
    while (true) {
        led1 = !led1;
        wait(0.5);
    }
}

Please tell us:

  • Is there anything unique about your project?
  • What board are you building for?
  • What is the approximate size of the project in terms of the number of source/header files?

-Ralph, Team Mbed

24 Aug 2018

Hi Ralph, thanks for the quick answer, Im using:

  • Board: Mutitech-xDot STM32L151CCU6
  • libs: libxdot v3.1.0 mbed-os 5.4.7
  • mbed online compiler: v1.10.14.0

The project is quite little, got 15 .h and another 16 cpp files:

After compile program details:

/media/uploads/icarballeda/selection_088.png

27 Aug 2018

Hi Ignacio,

Thank you for the extra information. We were able to use an example project for the Mutitech-xDot with the libxdot library and with a bit of effort we recreated the problem. We have reported this to the Web Tools team.

We think for the time being you'll have to incorporate the #defines into your source or header files. We apologize for the inconvenience and will update you when we have more information on a fix.

-Ralph, Team Mbed

28 Aug 2018

Hi Ralph, Thanks for the answer, OK, please let me know when the web-tools team fix this problem, meanwhile i will use #defines in the headers.

01 Nov 2018

This was solved by the dev team. Bye & thanks!