Problems compiling Teensy for different USB endpoint type (with solution)

Hi,
Reopening this old thread because I’m running in the same issue trying to use -DUSB_AUDIO:
My project does not compile because the build flag USB_AUDIO does not define AUDIO_INTERFACE in usb_audio.h of the Teensy audio library, for some reason. Here is the ini that fails, resulting in a failure to recognize the type AudioOutputUSB:

[env:teensy40]
framework = arduino
platform = teensy
upload_protocol = teensy-cli
board = teensy40
build_flags = -DUSB_AUDIO
lib_deps = paulstoffregen/Audio @ ^1.3

Note that my code works when compiled/uploaded from the Arduino IDE.
Thanks for your help!