Introjucer fails to build with C++98


#1

Hi,

The Introjucer fails to build with last commits probably due to my C++98 compiler.

/Users/nicolas/Work/JUCE/extras/Introjucer/Builds/MacOSX/../../Source/Application/../../JuceLibraryCode/modules/juce_data_structures/../../../../../modules/juce_data_structures/values/juce_Value.h: In static member function 'static juce::Value& PathSettingsTab::getPathByKey(const juce::String&, DependencyPathOS)':
/Users/nicolas/Work/JUCE/extras/Introjucer/Builds/MacOSX/../../Source/Application/../../JuceLibraryCode/modules/juce_data_structures/../../../../../modules/juce_data_structures/values/juce_Value.h:224: error: 'juce::Value& juce::Value::operator=(const juce::Value&)' is private
/Users/nicolas/Work/JUCE/extras/Introjucer/Builds/MacOSX/../../Source/Application/jucer_GlobalPreferences.cpp:119: error: within this context
/Users/nicolas/Work/JUCE/extras/Introjucer/Builds/MacOSX/../../Source/Application/jucer_GlobalPreferences.cpp: In static member function 'static juce::String PathSettingsTab::getFallbackPathByKey(const juce::String&, DependencyPathOS)':
/Users/nicolas/Work/JUCE/extras/Introjucer/Builds/MacOSX/../../Source/Application/jucer_GlobalPreferences.cpp:132: error: 'DependencyPathOS' is not a class or namespace
/Users/nicolas/Work/JUCE/extras/Introjucer/Builds/MacOSX/../../Source/Application/jucer_GlobalPreferences.cpp:137: error: 'DependencyPathOS' is not a class or namespace
/Users/nicolas/Work/JUCE/extras/Introjucer/Builds/MacOSX/../../Source/Application/jucer_GlobalPreferences.cpp:138: error: 'DependencyPathOS' is not a class or namespace
/Users/nicolas/Work/JUCE/extras/Introjucer/Builds/MacOSX/../../Source/Application/jucer_GlobalPreferences.cpp:147: error: 'DependencyPathOS' is not a class or namespace
/Users/nicolas/Work/JUCE/extras/Introjucer/Builds/MacOSX/../../Source/Application/jucer_GlobalPreferences.cpp:148: error: 'DependencyPathOS' is not a class or namespace
/Users/nicolas/Work/JUCE/extras/Introjucer/Builds/MacOSX/../../Source/Application/jucer_GlobalPreferences.cpp:156: error: 'DependencyPathOS' is not a class or namespace
/Users/nicolas/Work/JUCE/extras/Introjucer/Builds/MacOSX/../../Source/Application/jucer_GlobalPreferences.cpp:160: error: 'DependencyPathOS' is not a class or namespace

There is two errors.

  1. Because C++98 doesn’t manage scoped enum (works for instance with the code below).

https://github.com/julianstorer/JUCE/blob/master/extras/Introjucer/Source/Application/jucer_GlobalPreferences.cpp#L156

return os == DependencyPath::windows ? "c:\\SDKs\\android-sdk" : "~/Library/Android/sdk";
  1. The second as assignment operator of Value is private at link below.

https://github.com/julianstorer/JUCE/blob/master/extras/Introjucer/Source/Application/jucer_GlobalPreferences.cpp#L119

But it is less obvious for me to solve it without investigating a bit more.


#2
getAppSettings().pathValues[key].setValue (getAppSettings().projectDefaults.getPropertyAsValue (key, nullptr));

???


#3

Sorry for that, my mistake! I am so used to writing scoped enums that I always forget they aren't in the C++98 standard...

As for the second one: no, Value::setValue() does something very different! It just copies over the underlying var value, which will leave you with a Value object referring to another var than the one on the right hand side. The right call here is Value::referTo().

I fixed both errors, please update.


#4
  1. It seems common ; jules do the same :wink:
  2. I was not sure about setValue / referTo. Bad luck. Thanks for the explanation.

Anyway compiles fine now.