Strange Behavior while using compiler directives


#1

Hi all,

I encountered a strange behavior after I upgraded from 1.1.0 to 1.1.2 and also in 1.2.0 beta while using compiler directives.

I have the following example
test.h

#define TEST_MODE

test.c

void test(void) {
#ifdef TEST_MODE
   adl_atSendResponse(ADL_AT_RSP,"test mode active");
#else
  adl_atSendResponse(ADL_AT_RSP,"test mode inactive");
#endif
}

in M2MStudio 1.1.0 if I have the compiler definition and do a build I get a dwl witch is showing the message “test mode active” and if I comment the definition in test.h, save the change and compile it again I get to new version witch shows the message “test mode inactive”.

Now in version 1.1.2 and the new 1.2 beta version if I do the same steps as in 1.1.0 the version with the definition active is compiled and get the “test mode active” but after I comment the definition in test.h file, save it and a build I get the message “Nothing to build”. But there is a “major” change in how the new dwl will behave.

Any ideas on how to solve this issue/bug because I have a modular application witch share the same core code and I do not want to split the project in 2 or more projects because I will have to change them all if I do some new features or change old ones.


#2

Error in precompiler directive sintax.
Why used "#elseif " (and where is corrsponding conditional expression?) instead of simple “#else”?


#3

Sorry for that typo mistake. I edited the post to correct the typo.
I do not have errors in my code I was trying only to exemplify what I did in my application.


#4

Probably your project uses test.h from some other place, and you comment just an unused copy of it. Try to rename TEST_MODE macro to something else and rebuild. If it is actually generated from another file it will compile succesfully and now you will know what to fix.


#5

This is a known bug of 1.1.1 & 1.1.2 versions
cf [url]https://forum.sierrawireless.com/t/dependencies-not-generated-properly/3941/1]
We’ve released a patched 1.1.2 version to fix it
It is also fixed in 1.2.0 version…