#Include on first line fails to compile in Sparkulator

I’m not sure if it’s just this code or what, but if I try to use an #include on the first line of the Sparkulator, compilation fails. I’ve included screenshots to illustrate the line number change.

“Bad” code:

Results in:

In file included from ../inc/spark_wiring.h:30:0,
from ../inc/application.h:31,
from wi-3d.cpp:2:
../../core-common-lib/SPARK_Firmware_Driver/inc/config.h:12:2: warning: #warning "Defaulting to Release Build" [-Wcpp]
In file included from wi-3d.cpp:1:0:
elapsedMillis.h: In constructor 'elapsedMillis::elapsedMillis()':
elapsedMillis.h:30:36: error: 'millis' was not declared in this scope
elapsedMillis.h: In constructor 'elapsedMillis::elapsedMillis(long unsigned int)':
elapsedMillis.h:31:49: error: 'millis' was not declared in this scope

... ommitted for brevity ...

make: *** [wi-3d.o] Error 1```

Good code:
<img src="/uploads/particle/1332/eae9ce848cc2e8e1.PNG" width="223" height="135">

Results in:
```Code verified! Great work.```

Well that seems silly. :frowning:

I think the pre-processor is looking for when your include blocks start, so it can inject the #include "application.h", and it’s probably getting confused. I’ll log a bug for this.

Thanks!
David

wgbartley, #include “application.h” is not included in the elapsedMillis.h since that was done in the “old” days. I should review all my github libraries to include that include (!) :smile:

It actually doesn’t seem to need it, unless you try to include it on the first line instead of the second.