Sparkulator: Code that once compiled, no longer compiles [SOLVED]

I have an older firmware that I recently referenced (read: copy and pasted) when throwing together a quick project. When I tried to compile the new project, I received a bunch of ... not declared errors. Strange… I copied the code verbatim from another project that I know worked the last time I compiled it. So, I tried recompiling the original and it verified okay. Then I remembered that the Sparkulator doesn’t actually recompile if code hasn’t changed. I added a comment line and attempted to recompile…no dice.

In the interest of total disclosure, I have copied and pasted the old-but-no-longer-working code into a “Spark Sensor Madness with Classes” gist. The error output is pasted at the end of this post. I tried adding #include "application.h" dang near everywhere, but it didn’t do any good. In this use case, I am only interested in the Thermistor.cpp/.h files. If I remove those files as separate includes and paste the contents directly into the main .ino file in Sparkulator, it compiles with no issues.

Here’s the error output from the “Sensor Madness” code:

In file included from DHT.cpp:1:0:
DHT.h:16:9: error: 'uint8_t' does not name a type
DHT.h:17:9: error: 'uint8_t' does not name a type
DHT.h:23:21: error: expected ')' before 'pin'
DHT.cpp:3:9: error: expected constructor, destructor, or type conversion before '(' token
DHT.cpp: In member function 'void DHT::begin()':
DHT.cpp:13:13: error: '_pin' was not declared in this scope
DHT.cpp:13:19: error: 'INPUT' was not declared in this scope
DHT.cpp:13:24: error: 'pinMode' was not declared in this scope
DHT.cpp:14:24: error: 'HIGH' was not declared in this scope
DHT.cpp:14:28: error: 'digitalWrite' was not declared in this scope
DHT.cpp: In member function 'float DHT::readTemperature(bool)':
DHT.cpp:24:17: error: '_type' was not declared in this scope
DHT.cpp:26:22: error: 'data' was not declared in this scope
DHT.cpp: In member function 'float DHT::readHumidity()':
DHT.cpp:63:17: error: '_type' was not declared in this scope
DHT.cpp:65:22: error: 'data' was not declared in this scope
DHT.cpp: In member function 'bool DHT::read()':
DHT.cpp:84:5: error: 'uint8_t' was not declared in this scope
DHT.cpp:84:13: error: expected ';' before 'laststate'
DHT.cpp:85:13: error: expected ';' before 'counter'
DHT.cpp:86:13: error: expected ';' before 'j'
DHT.cpp:90:18: error: '_pin' was not declared in this scope
DHT.cpp:90:24: error: 'HIGH' was not declared in this scope
DHT.cpp:90:28: error: 'digitalWrite' was not declared in this scope
DHT.cpp:91:14: error: 'delay' was not declared in this scope
DHT.cpp:93:26: error: 'millis' was not declared in this scope
DHT.cpp:107:5: error: 'data' was not declared in this scope
DHT.cpp:110:19: error: 'OUTPUT' was not declared in this scope
DHT.cpp:110:25: error: 'pinMode' was not declared in this scope
DHT.cpp:111:24: error: 'LOW' was not declared in this scope
DHT.cpp:113:9: error: 'noInterrupts' was not declared in this scope
DHT.cpp:115:25: error: 'delayMicroseconds' was not declared in this scope
DHT.cpp:116:19: error: 'INPUT' was not declared in this scope
DHT.cpp:119:11: error: 'i' was not declared in this scope
DHT.cpp:120:9: error: 'counter' was not declared in this scope
DHT.cpp:122:32: error: 'digitalRead' was not declared in this scope
DHT.cpp:122:37: error: 'laststate' was not declared in this scope
DHT.cpp:130:9: error: 'laststate' was not declared in this scope
DHT.cpp:130:37: error: 'digitalRead' was not declared in this scope
DHT.cpp:138:18: error: 'j' was not declared in this scope
DHT.cpp:140:27: error: '_count' was not declared in this scope
DHT.cpp:147:9: error: 'interrupts' was not declared in this scope
DHT.cpp:151:10: error: 'j' was not declared in this scope
make: *** [DHT.o] Error 1```

Hmmmm… weird… how about if #include "DHT.h" is in the DHT.cpp?

I’m out right now and can try compiling later when I get home and hopefully some good news when you wake up :slight_smile:

It is. :frowning:

< filler text >

Looks like missing some headers? for example: #include <inttypes.h> ?

That didn't work either.

I see some stuff which I might change to get it working. Get some rest? :stuck_out_tongue:

1 Like

Not hardly! I plowed on ahead with the rest of the project instead. I'm at a good stopping point, so I think I'm going to try and get some sleep until the kids wake me up in 5 hours. :zzz:

Thanks for looking into this with me @kennethlimcp and @mamahow!

Seems fun to wake up and see this…

You probably got too tired cos all i did is add "application.h" to each .cpp and .h :smiley:

I swear I tried that. That, or someone changed something on the Sparkulator compile-side to fix it. It must be :spark: gnomes.

1 Like

I’m willing to bet some coffee on your lack of sleep :stuck_out_tongue:

Go compile it without any changes and see how it goes!