pubsubclient won't compile in Arduino and VSCode IDEs
The library is somehow modified. There should be no {} in virtual size_t write(uint8_t) {}; or the whole line shouldn't be in this .h.

Reinstall the library.