Build flag -DARDUINO_USB_MODE=1 fails

Building an Arduino project for a self-built ESP32 S2 board.
Project compiles just fine, but when adding the build flag
-DARDUINO_USB_MODE=1
it fails with the following error message

In file included from /Users/julian/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:197,
from src/main.cpp:1:
src/main.cpp: In function ‘void printMessage(int)’:
/Users/julian/.platformio/packages/framework-arduinoespressif32/cores/esp32/HardwareSerial.h:356:16: error: ‘HWCDCSerial’ was not declared in this scope
356 | #define Serial HWCDCSerial

and a bunch of repetitions of the same.

I’m a little out of my depth here. Without the flag the ESP won’t register as an USB device, so i have no serial connection when not in Boot mode.
Happy to hear any pointers.

Please show the complete content of your platformio.ini
Especially the board setting would be of interest.

turns out, setting the flag to 0 actually works. and i have absolutely no idea why, but thanks, i consider this solved :wink: