Build_flags / strange behavious / esp8266


#1

Hi, I’d need your help/advise
Something strange is happening in my esp8266 related project.
I used build_flags to include / excluded certain part of the code in such a way to create different versions of my soft.
eg.
build_flags = ${esp8266_1M.build_flags} -D T6_CONFIG
it sets constant T6_CONFIG which I use to include code for a specific version of my soft

Very few days I started facing issues that such a code

#if defined(WHATEVER)
void MQTTPublishParticleSensorData(HPMA115S0_DATA d) {}
#endif

started raising compilation errors, because

  • it can’t process code between #if #endif
  • it doesn’t recognise HPMA115S0_DATA data structure.
    In general, it makes sense because
  • it’s not a part of this version, so the definition of HPMA115S0_DATA has not been included earlier by the compiler
    but the problem is that compiler shouldn’t process the code between #if #endif because Preprocessor should exclude it becuase constant WHATEVER is nowhere set before in particular in platformio.ino - it’s my understanding and how I see it works in many places of my code

if I added slash as below (I just added it by coincidence while testing something), then it suddenly works perfectly???

#if defined(WHATEVER)
/
void MQTTPublishParticleSensorData(HPMA115S0_DATA d) {}
#endif

I don’t have a clue what’s going on

Atom: 1.33.0

I realised it’s complicated to describe.

I’d much appriciate your help


#2

Could you provide a simple project to reproduce this issue?


#3

hi, I can’t replcate it on a simple project.