Serial Monitor not working in PlatformIO with LOLIN S3 (works in Arduino IDE)

When flashing the ESP32-S3 using Arduino IDE , the Serial Monitor works as expected .

However, when flashing the exact same code using PlatformIO , no serial output appears afterward.

My platformio.ini :

[env:lolin_s3]
platform      = espressif32
board         = lolin_s3
framework     = arduino
monitor_port  = /dev/ttyUSB0  
monitor_speed = 115200
build_flags   = -D PIO_FRAMEWORK_ARDUINO_USB_CDC_ON_BOOT=1

Arduino IDE settings:
board: LOLIN S3
port: tty/USB0

the code is:

void setup()
{
  Serial.begin(115200);
  delay(1000);
  Serial.println("Hello from LOLIN S3!");
}

void loop()
{
  Serial.println("Still alive...");
  delay(1000);
}

I’d appreciate any help or suggestions on what might be missing in my PlatformIO setup. Thanks!

What? Where does that macro name come from? Is this something ChatGPT hallucinated?

It should be called just ARDUINO_USB_CDC_ON_BOOT.