When trying to compile this code I am getting four variables with "multiple definition of ". The problem (in Red) sections from the Arduino error messages are listed below. Both the main sketch and homekit_config.c include the homekit_config.h file. It should not get loaded by both but appears to be doing that. Could the "#ifndef HOMEKIT_CONFIGH99D20943_B47B_45CD_AF23_FF497B9150D8" line not be working?
I have tried the Wemos D1 mini and NodeMCU boards.
The Arduino IDE also required for the folder name to match the name of the .ino sketch name.
I have tried moving lines 44-47 in homekit_config.h into different files without success.
Any suggestions?
/var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/esp8266_homekit_github.ino.cpp.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:44: multiple definition of current_heating_cooling_state'; /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/homekit_config.c.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:44: first defined here /Users/george/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/esp8266_homekit_github.ino.cpp.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:45: multiple definition oftarget_heating_cooling_state'; /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/homekit_config.c.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:45: first defined here
/Users/george/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/esp8266_homekit_github.ino.cpp.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:46: multiple definition of target_temperature'; /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/homekit_config.c.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:46: first defined here /Users/george/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/esp8266_homekit_github.ino.cpp.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:47: multiple definition oftemperature_display_unit'; /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/homekit_config.c.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:47: first defined here
I was able to pull out just the HomeKit code and add it to a different Arduino sketch and get it to work. I never did figure out the compilation problem with the code as it is.
When trying to compile this code I am getting four variables with "multiple definition of ". The problem (in Red) sections from the Arduino error messages are listed below. Both the main sketch and homekit_config.c include the homekit_config.h file. It should not get loaded by both but appears to be doing that. Could the "#ifndef HOMEKIT_CONFIGH99D20943_B47B_45CD_AF23_FF497B9150D8" line not be working?
I have tried the Wemos D1 mini and NodeMCU boards. The Arduino IDE also required for the folder name to match the name of the .ino sketch name. I have tried moving lines 44-47 in homekit_config.h into different files without success. Any suggestions?
/var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/esp8266_homekit_github.ino.cpp.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:44: multiple definition of
current_heating_cooling_state'; /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/homekit_config.c.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:44: first defined here /Users/george/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/esp8266_homekit_github.ino.cpp.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:45: multiple definition of
target_heating_cooling_state'; /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/homekit_config.c.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:45: first defined here /Users/george/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/esp8266_homekit_github.ino.cpp.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:46: multiple definition oftarget_temperature'; /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/homekit_config.c.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:46: first defined here /Users/george/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld: /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/esp8266_homekit_github.ino.cpp.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:47: multiple definition of
temperature_display_unit'; /var/folders/q8/ld8hb0dj2074pkp69s2v65z40000gn/T/arduino_build_365515/sketch/homekit_config.c.o:/Users/george/Downloads/Homekit_AQI_Desk-master/esp8266_homekit_github/homekit_config.h:47: first defined here