I was using a library (SAMD_PWM) that wanted SerialUSB, but it was undefined in my IDE.
At the beginning of my sketch I simply added:
#define SerialUSB Serial
and everything worked fine.