You're using the wrong version of MSVC. Using the latest version of MSVC 2022, these are the only work-arounds you need to apply: https://docs.mamedev.org/initialsetup/compilingmame.html#issues-affecting-microsoft-visual-studio