All, I have been fighting to compile MAME with MS Visual C (Visual Studio, MSVS) for some time. I am down to just one error which is related to a "dynamic_cast". Error is:

332>C:\Users\stuar\Documents\mame-ai\src\emu\devfind.h(644,1): error C2680: 'DeviceClass *': invalid target type for dynamic_cast
332>C:\Users\stuar\Documents\mame-ai\src\emu\devfind.h(644,1): error C2680: with
332>C:\Users\stuar\Documents\mame-ai\src\emu\devfind.h(644,1): error C2680: [
332>C:\Users\stuar\Documents\mame-ai\src\emu\devfind.h(644,1): error C2680: DeviceClass=mc68hc16z1_device
332>C:\Users\stuar\Documents\mame-ai\src\emu\devfind.h(644,1): error C2680: ]
332>C:\Users\stuar\Documents\mame-ai\src\emu\devfind.h(644,1): error C2680: this->m_target = dynamic_cast<DeviceClass *>(device);
332>C:\Users\stuar\Documents\mame-ai\src\emu\devfind.h(644,1): error C2680: ^
332>C:\Users\stuar\Documents\mame-ai\src\emu\devfind.h(644,1): message : 'mc68hc16z1_device': class must be defined before using in a dynamic_cast
332>C:\Users\stuar\Documents\mame-ai\src\emu\devfind.h(644,1): message : this->m_target = dynamic_cast<DeviceClass *>(device);
332>C:\Users\stuar\Documents\mame-ai\src\emu\devfind.h(644,1): message : ^
332>C:\Users\stuar\Documents\mame-ai\src\emu\devfind.h(636): message : while compiling class template member function 'bool device_finder<mc68hc16z1_device,true>::findit(validity_checker *)'
This is in the findit() function.

I have tried MSVS 2022 and 2019, forced the compiler to C17 and C20, all on Windows 11.

I have followed the guidelines in "Compiling MAME / Issues Affecting Visual Studio". No luck.

I am compiling code from July 19, 2022 (Commit hash 2ff1f130c34a6ff29468d9f9d633ba13659180e3).

I have some ideas and would like to eventually contribute to the mainline sources, but obviously I'm not contributing anything until I can compile! Any help would be greatly appreciated!

Thanks