Build system suddenly broke?

My build system suddenly broke. I restarted VSCode and it stopped compiling.
the code can, for example, be found here. sparkles/client-config at main · hdsjulian/sparkles · GitHub

here’s some errors it’s throwing, i somehow assume the precompiler isn’t starting or header files are ignored?

i have these lines

#if DEVICE_MODE != 2
#include <ledHandler.h>
#else
#include <webserver.h>
class webserver;
#endif

and get

In file included from src/main.cpp:18:
src/webserver.h:17:7: error: declaration of ‘struct messaging::webserver’ changes meaning of ‘webserver’ [-fpermissive]
17 | class webserver {
| ^~~~~~~~~
In file included from src/webserver.h:14:
src/messaging.h:8:7: note: ‘webserver’ declared here as ‘class webserver’
8 | class webserver;

I get tons of other issues. The code compiled minutes ago. I don’t even know where to start, because this problem is very clearly something with the compiler, not with my code?

The first error I see is “'ledcAttach' was not declared in this scope

This function was introduced to Arduino Core 3.x which is not yet available in PlatformIO.

Changing your platformio.ini to

[env:d1]
platform = espressif32@6.7.0
board = wemos_d1_mini32
framework = arduino
lib_deps = 
	khoih-prog/ESP32TimerInterrupt@^2.3.0
	https://github.com/leandcesar/PeakDetection
upload_port = /dev/tty.usbserial-0264D1KX
monitor_port = /dev/tty.usbserial-0264D1KX
monitor_speed = 115200
-D DEVICE_USED=3
-D DEVICE_MODE=1

platform_packages=
  framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.1
  framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.1/esp32-arduino-libs-3.0.1.zip

[env:Blinky]
platform = espressif32@6.7.0
board = esp32-s2-saola-1
framework = arduino
lib_deps = 
	khoih-prog/ESP32TimerInterrupt@^2.3.0
	https://github.com/leandcesar/PeakDetection
upload_port = /dev/tty.usbmodem01
monitor_port = /dev/tty.usbmodem01
monitor_speed = 115200
build_flags = -DARDUINO_USB_CDC_ON_BOOT=1
    -DARDUINO_USB_MODE=0
	-DDEVICE_USED=2
	-DDEVICE_MODE=1

platform_packages=
  framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.1
  framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.1/esp32-arduino-libs-3.0.1.zip

makes the blinky configuration built without issues.

But there are a few other issues with your code like including local header files by using #include <headerfilename.h> instead of #include "headerfilename.h"

oh, so it builds with you? yes, i installed v 3.0, maybe it somehow overwrote that.
thanks so much!!

These headers are not well written. stateMachine.h uses the String type without having included Arduino.h, so it’s not usable standalone. messaging.h does various includes outside the include guard (ifndef MESSAGING_H). You’re doing include guards but are including other files outside of it, which is bad practice.

The main culprits is like that plus some oversights in opening brackets:

So the whole class messaging isn’t properly closed.

The sparkles-client-config subproject specifically has environemnts like D1 which don’t set the

	-DDEVICE_USED=2
	-DDEVICE_MODE=1

so they completely fail to build.

Includes like

#include "webserver.h"

will fail to compile on Linux if that was meant to include the ESP32 builtin library WebServer.h, due to wrong upper+lowercasing. Only works on Windows.

The repository doesn’t have an Continuous Integration setup that test-compiles the PIO project(s) at every commit in all possible configurations, so breaking compilation errors in some environments easily slip through. This is very easy to setup.

I’ve done a PR fixing the absolute bare minimum to get PlatformIO to display “success” at Fix compilation for sparkles-client-config BlinkyV3 env by maxgerhardt · Pull Request #13 · hdsjulian/sparkles · GitHub.

1 Like

amazing, thank you. yeah it’s my first larger C++ project and i’m basically only trying to get this done for an art project at a festival. already out camping, frantically trying to fix my firmware. thank you so much!