panStamp / thermistor

Arduino library for NTC thermistors
GNU Lesser General Public License v3.0
42 stars 20 forks source link

Compilation error: redefinition of 'THERMISTOR thermistor' #12

Closed Marco-rc closed 5 months ago

Marco-rc commented 5 months ago

Hello, I copied the sketch on GitHub in a new sketch, loaded the library and compiled it, but upon compiling the file I get the following error. Please help.

C:\Users\Marco\AppData\Local\Temp.arduinoIDE-unsaved202451-2376-6zwjkx.bua0p\sketchjun1b_0440-_Thermistor_with_library.ino:77:31: error: redefinition of 'THERMISTOR thermistor'

define NTC_PIN A0

                           ^

C:\Users\Marco\AppData\Local\Temp.arduinoIDE-unsaved202451-2376-6zwjkx.bua0p\sketchjun1b_0440-_Thermistor_with_library.ino:80:23: note: in expansion of macro 'NTC_PIN' THERMISTOR thermistor(NTC_PIN, // Analog pin ^~~ C:\Users\Marco\AppData\Local\Temp.arduinoIDE-unsaved202451-2376-6zwjkx.bua0p\sketch_jun1b\sketch_jun1b.ino:80:12: note: 'THERMISTOR thermistor' previously declared here THERMISTOR thermistor(NTC_PIN, // Analog pin ^~~~~~ C:\Users\Marco\AppData\Local\Temp.arduinoIDE-unsaved202451-2376-6zwjkx.bua0p\sketchjun1b_0440-_Thermistor_with_library.ino:86:10: error: redefinition of 'uint16_t temp' uint16_t temp; ^~~~ C:\Users\Marco\AppData\Local\Temp.arduinoIDE-unsaved202451-2376-6zwjkx.bua0p\sketch_jun1b\sketch_jun1b.ino:86:10: note: 'uint16_t temp' previously declared here uint16_t temp; ^~~~ C:\Users\Marco\AppData\Local\Temp.arduinoIDE-unsaved202451-2376-6zwjkx.bua0p\sketchjun1b_0440-_Thermistor_with_library.ino: In function 'void setup()': C:\Users\Marco\AppData\Local\Temp.arduinoIDE-unsaved202451-2376-6zwjkx.bua0p\sketchjun1b_0440-_Thermistor_with_library.ino:93:6: error: redefinition of 'void setup()' void setup() ^~~~~ C:\Users\Marco\AppData\Local\Temp.arduinoIDE-unsaved202451-2376-6zwjkx.bua0p\sketch_jun1b\sketch_jun1b.ino:93:6: note: 'void setup()' previously defined here void setup() ^~~~~ C:\Users\Marco\AppData\Local\Temp.arduinoIDE-unsaved202451-2376-6zwjkx.bua0p\sketchjun1b_0440-_Thermistor_with_library.ino: In function 'void loop()': C:\Users\Marco\AppData\Local\Temp.arduinoIDE-unsaved202451-2376-6zwjkx.bua0p\sketchjun1b_0440-_Thermistor_with_library.ino:103:6: error: redefinition of 'void loop()' void loop() ^~~~ C:\Users\Marco\AppData\Local\Temp.arduinoIDE-unsaved202451-2376-6zwjkx.bua0p\sketch_jun1b\sketch_jun1b.ino:103:6: note: 'void loop()' previously defined here void loop() ^~~~

exit status 1

Compilation error: redefinition of 'THERMISTOR thermistor'

Thank you.

Marco-rc commented 5 months ago

I found the issue , thank you and sorry for the trouble, I had defined twice the same variable. First onmy own sketch and then when reading the library.