Errors in juce_MathsFunctions.h in 5.1.0-0 when using VS 2013


#1

Updated to 5.1.0-0-g8bb611f4d tonight. While I can build OK on linux, my 32-bit and 64-bit Windows builds are both broken in the same places. I’m using VisualStudio 2013 on Windows 7. Errors I’m seeing are all in juce_Mathsfunctions.h. Looks like this:

jucelibrarycode\modules\juce_core\maths/juce_MathsFunctions.h(346): error C2146: syntax error : missing ';' before identifier 'FloatType' [build32\src-img\gml_img.vcxproj]
jucelibrarycode\modules\juce_core\maths/juce_MathsFunctions.h(350) : see reference to class template instantiation 'juce::MathConstants<FloatType>' being compiled
jucelibrarycode\modules\juce_core\maths/juce_MathsFunctions.h(346): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [build32\src-img\gml_img.vcxproj]
jucelibrarycode\modules\juce_core\maths/juce_MathsFunctions.h(349): error C2146: syntax error : missing ';' before identifier 'FloatType' [build32\src-img\gml_img.vcxproj]
jucelibrarycode\modules\juce_core\maths/juce_MathsFunctions.h(349): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [build32\src-img\gml_img.vcxproj]
jucelibrarycode\modules\juce_core\maths/juce_MathsFunctions.h(349): error C2086: 'int juce
::MathConstants<FloatType>::constexpr' : redefinition [build32\src-img\gml_img.vcxproj]
jucelibrarycode\modules\juce_core\maths/juce_MathsFunctions.h(346) : see declaration of 'juce::MathConstants<FloatType>::constexpr'

Suspecting that VS2013 doesn’t support constexpr, I commented it out and put in const instead, but that still isn’t working. Error messages then become:

jucelibrarycode\modules\juce_core\maths/juce_MathsFunctions.h(346): error C2864: 'juce::MathConstants<double>::pi' : a static data member with an in-class initializer must have non-volatile const integral type
      type is 'const double'
jucelibrarycode\modules\juce_core\maths/juce_MathsFunctions.h(355) : see reference to class template instantiation 'juce::MathConstants<double>' being compiled

But at now past 1am, I have to stop for the night.


#2

It’s not compatible with VS 2013. You need to update Visual Studio.


#3

The new module juce_dsp is not compatible with VS 2013 indeed, but juce_core should still be compatible.

@StephaneCharette: a quick (and quite dirty) fix consists in deleting the struct MathConstants and then putting back the literal values for double_Pi (3.1415926535897932384626433832795) and float_Pi (3.14159265358979323846f).


#4

Can you confirm that this is fixed on develop with ec2f721? If yes, we’ll release a hotfix for the issue.


#5

I confirm that building Projucer with VS2013 works after I cherry-picked ec2f721 on top of master.


#6

I’m not using juce_dsp.


#7

Cherry-picked that commit and can now build again with my old VS 2013. Thanks!


#8

Will the commit be ported to master?


#9

Oh yes, thanks for reminding me.


#10

The changes worked for me too.