Posts: 2
Joined: Tue Sep 19, 2017 1:05 pm

Compiling issue with VS2017


I was attempting to build and run the MAME source on Windows with the only version of Visual Studio I have on this machine, which is VS 2017 Community Edition. I generated the VS solution, opened it and retargeted it to my version of the windows SDK.

Compiling it, I'm encountering this compilation error for the COMP macro for every driver:

Code: Select all

..\..\..\..\..\src\mame\drivers\rmhaihai.cpp(735): error C2975: 'driver_device_creator': invalid template argument for 'FullName', expected compile-time constant expression 18> c:\development\mame\src\emu\device.h(284): note: see declaration of 'driver_device_creator'

The error occurs for template argument 'FullName', 'ShortName', and 'Source'.

There's something about GAME_DRIVER_TRAITS in gamedrv.h that driver_device_creator doesn't like as its template parameters. Maybe there's something with the code that the 2017 compiler doesn't like that was acceptable with previous versions.

Code: Select all

// static game traits #define GAME_DRIVER_TRAITS(NAME, FULLNAME) \ namespace { \ struct GAME_TRAITS_NAME(NAME) { static constexpr char const shortname[] = #NAME, fullname[] = FULLNAME, source[] = __FILE__; }; \ constexpr char const GAME_TRAITS_NAME(NAME)::shortname[], GAME_TRAITS_NAME(NAME)::fullname[], GAME_TRAITS_NAME(NAME)::source[]; \ } #define GAME_DRIVER_TYPE(NAME, CLASS, FLAGS) \ driver_device_creator< \ CLASS, \ (GAME_TRAITS_NAME(NAME)::shortname), \ (GAME_TRAITS_NAME(NAME)::fullname), \ (GAME_TRAITS_NAME(NAME)::source), \ game_driver::unemulated_features(FLAGS), \ game_driver::imperfect_features(FLAGS)>

I can build it though the command line no problem.

Anybody encountered this? Searching the forum didn't reveal anything similar to this problem.


User avatar
Posts: 89
Joined: Thu Nov 06, 2014 12:44 pm
Location: Land of Oz
Contact: Website

Re: Compiling issue with VS2017

Last edited by Robert on Fri May 03, 2019 2:44 pm, edited 1 time in total.

Posts: 2
Joined: Tue Sep 19, 2017 1:05 pm

Re: Compiling issue with VS2017

Robert wrote:
Thu Sep 21, 2017 7:47 am
I've heard that VS2017 has bugs.
And this is true. Turns out after updating my install of Visual Studio 2017 the code built without modification. I guess my install was too old and had compiler bugs.

Return to “MAME Discussion”