Page 1 of 1

Compiling issue with VS2017

Posted: Wed Sep 20, 2017 1:30 am
by coin0perated
Hi,

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.

Thanks!
coin0p

Re: Compiling issue with VS2017

Posted: Thu Sep 21, 2017 7:47 am
by Robert
I've heard that VS2017 has bugs.

Re: Compiling issue with VS2017

Posted: Sat Sep 23, 2017 12:26 pm
by coin0perated
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.