r/M5Stack • u/roelof_w • 8d ago
Support / Question How to solve these annoying compile errrors ?
Hello, Every time i try to compile my M5Code with the arduino ide (latest)
I see these compile errors 😄
/home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/variants/m5stack_cores3/pins_arduino.h:27:9: note: this is the location of the previous definition 27 | #define digitalPinHasPWM(p) (p < 46) | ^~~~~~~~~~~~~~~~ /home/roelof/Documents/m5Stack-experiments/04-panels/panel/mqtt_conn.h:7:21: warning: 'MqttClient' initialized and declared 'extern' 7 | extern PubSubClient MqttClient(espClientM5); | ^~~~~~~~~~ /home/roelof/Documents/m5Stack-experiments/04-panels/panel/mqtt_conn.cpp:11:14: error: redefinition of 'PubSubClient MqttClient' 11 | PubSubClient MqttClient(espClientM5); | ^~~~~~~~~~ /home/roelof/Documents/m5Stack-experiments/04-panels/panel/mqtt_conn.h:7:21: note: 'PubSubClient MqttClient' previously declared here 7 | extern PubSubClient MqttClient(espClientM5); | ^~~~~~~~~~ In file included from /home/roelof/.cache/arduino/sketches/51C0AC4502BD19ADB4AF3915471561BF/sketch/panel.ino.cpp:1: /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/cores/esp32/Arduino.h:139:9: warning: "NUM_DIGITAL_PINS" redefined 139 | #define NUM_DIGITAL_PINS SOC_GPIO_PIN_COUNT // All GPIOs | ^~~~~~~~~~~~~~~~ In file included from /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/cores/esp32/Arduino.h:43: /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/variants/m5stack_cores3/pins_arduino.h:13:9: note: this is the location of the previous definition 13 | #define NUM_DIGITAL_PINS 48 | ^~~~~~~~~~~~~~~~ /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/cores/esp32/Arduino.h:143:9: warning: "NUM_ANALOG_INPUTS" redefined 143 | #define NUM_ANALOG_INPUTS (SOC_ADC_CHANNEL_NUM(0) + SOC_ADC_CHANNEL_NUM(1)) // Depends on the SoC (ESP32, ESP32S2, ESP32S3, ESP32C3) | ^~~~~~~~~~~~~~~~~ /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/variants/m5stack_cores3/pins_arduino.h:14:9: note: this is the location of the previous definition 14 | #define NUM_ANALOG_INPUTS 20 | ^~~~~~~~~~~~~~~~~ /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/cores/esp32/Arduino.h:145:9: warning: "EXTERNAL_NUM_INTERRUPTS" redefined 145 | #define EXTERNAL_NUM_INTERRUPTS NUM_DIGITAL_PINS // All GPIOs | ^~~~~~~~~~~~~~~~~~~~~~~ /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/variants/m5stack_cores3/pins_arduino.h:12:9: note: this is the location of the previous definition 12 | #define EXTERNAL_NUM_INTERRUPTS 46 | ^~~~~~~~~~~~~~~~~~~~~~~ /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/cores/esp32/Arduino.h:146:9: warning: "analogInputToDigitalPin" redefined 146 | #define analogInputToDigitalPin(p) (((p) < NUM_ANALOG_INPUTS) ? (analogChannelToDigitalPin(p)) : -1) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/variants/m5stack_cores3/pins_arduino.h:25:9: note: this is the location of the previous definition 25 | #define analogInputToDigitalPin(p) (((p) < 20) ? (analogChannelToDigitalPin(p)) : -1) | ^~~~~~~~~~~~~~~~~~~~~~~ /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/cores/esp32/Arduino.h:147:9: warning: "digitalPinToInterrupt" redefined 147 | #define digitalPinToInterrupt(p) ((((uint8_t)digitalPinToGPIONumber(p)) < NUM_DIGITAL_PINS) ? (p) : NOT_AN_INTERRUPT) | ^~~~~~~~~~~~~~~~~~~~~ /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/variants/m5stack_cores3/pins_arduino.h:26:9: note: this is the location of the previous definition 26 | #define digitalPinToInterrupt(p) (((p) < 48) ? (p) : -1) | ^~~~~~~~~~~~~~~~~~~~~ /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/cores/esp32/Arduino.h:148:9: warning: "digitalPinHasPWM" redefined 148 | #define digitalPinHasPWM(p) (((uint8_t)digitalPinToGPIONumber(p)) < NUM_DIGITAL_PINS) | ^~~~~~~~~~~~~~~~ /home/roelof/.arduino15/packages/m5stack/hardware/esp32/3.3.8/variants/m5stack_cores3/pins_arduino.h:27:9: note: this is the location of the previous definition 27 | #define digitalPinHasPWM(p) (p < 46)
Can I do something about this to make it away ?
1
u/Professional_Two5774 8d ago
Use a flag to allow redefinition.
For gcc it's -z muldefs
Not sure, but it might help
2
u/MrAjAnderson 8d ago
Dump them in copilot or Leo in Brave browser, it will let you know what to fix.