mupen64plus / mupen64plus-video-glide64mk2

Video plugin for Mupen64Plus 2.0 based on 10th anniversary release code from gonetz
28 stars 37 forks source link

Build fails in Visual Studio 2013 #103

Closed Postrediori closed 5 years ago

Postrediori commented 5 years ago

The plugin build fails with the following errors when beeing compiled with Visual Studio 2013.

1>------ Build started: Project: mupen64plus-video-rice, Configuration: Release Win32 ------
2>------ Build started: Project: mupen64plus-video-glide64mk2, Configuration: Release Win32 ------
1>  mupen64plus-video-rice.vcxproj -> D:\Rasim\Projects\mupen64plus\mupen64plus-ui-console\projects\VisualStudio2013\Release\mupen64plus-video-rice.dll
2>  TxFilter.cpp
2>..\..\src\GlideHQ\TxFilter.cpp(293): error C2057: expected constant expression
2>..\..\src\GlideHQ\TxFilter.cpp(293): error C2466: cannot allocate an array of constant size 0
2>..\..\src\GlideHQ\TxFilter.cpp(293): error C2133: 'thrd' : unknown size
2>..\..\src\GlideHQ\TxFilter.cpp(294): error C2057: expected constant expression
2>..\..\src\GlideHQ\TxFilter.cpp(294): error C2466: cannot allocate an array of constant size 0
2>..\..\src\GlideHQ\TxFilter.cpp(294): error C2133: 'params' : unknown size
2>  TxQuantize.cpp
2>..\..\src\GlideHQ\TxQuantize.cpp(1835): error C2057: expected constant expression
2>..\..\src\GlideHQ\TxQuantize.cpp(1835): error C2466: cannot allocate an array of constant size 0
2>..\..\src\GlideHQ\TxQuantize.cpp(1835): error C2133: 'thrd' : unknown size
2>..\..\src\GlideHQ\TxQuantize.cpp(1836): error C2057: expected constant expression
2>..\..\src\GlideHQ\TxQuantize.cpp(1836): error C2466: cannot allocate an array of constant size 0
2>..\..\src\GlideHQ\TxQuantize.cpp(1836): error C2133: 'params' : unknown size

Compile error is caused by arrays here and there initialized by the local variable numcore.

      SDL_Thread *thrd[numcore];
      QuantizeParams params[numcore];
Postrediori commented 5 years ago

Apparently this syntax is valid in GCC but is not supported by the VC 12.0 from VS2013 Express. It's possible to replace arrays with std::vector:

      std::vector<SDL_Thread *> thrd(numcore);
      std::vector<QuantizeParams> params(numcore);

Maybe there is a way to enable the gcc syntax in VS settings.

richard42 commented 5 years ago

yeah it's C99. I'm surprised that VS2013 doesn't support it. Maybe there's a setting. I'll take a look.

richard42 commented 5 years ago

I pushed a fix for this last night.

Postrediori commented 5 years ago

Cheers