Hi, you need do mbed deploy before compiling the code, because the project only has mbed-os.lib in it, instead of the code of Mbed OS, I missed the ERROR part of your log.
For anyone who runs into this issue, please check your MBED_OS_DIR
mbed config MBED_OS_DIR
At one point I changed the global os folder then renamed that folder, and ran into this issue weeks later. After unsetting global MBED_OS_DIR, I was able to compile my projects as usual.