Ahh yeah, that got me a while ago too.
For other readers by default the mbed build button compiles files that have changed or are affected by a change. Sometimes when you have weird issues and rebuild all solves it. which you can do by clicking "build all".