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```