RS-MET icon indicating copy to clipboard operation
RS-MET copied to clipboard

Error compiling juce module for c++ 17

Open alexdsp opened this issue 6 years ago • 3 comments

I am getting a compilation error when i set the language standard in the projucer from c++14 to c++17.

C2143 syntax error: missing ',' before '<' (compiling source file ....\JuceLibraryCode\include_rosic.cpp) Test_SharedCode c:\modules\rosic\datastructures\rosic_keyvaluemap.h 34

C2143 syntax error: missing ',' before '<' (compiling source file ....\JuceLibraryCode\include_rosic.cpp) Test_SharedCode c:\modules\rosic\datastructures\rosic_keyvaluemap.h 56

alexdsp avatar Mar 25 '19 17:03 alexdsp

i don't have c++17 yet. do you know, how to fix it? then i will apply it

RobinSchmidt avatar Mar 26 '19 10:03 RobinSchmidt

i didnt find a fix for that, what i ended up doing is comment out in rosic_KeyValueMap.h lines 33- 40 and lines 55-62:

template<class KeyType, class ValueType> struct KeyValuePairPointerLessByKey : std::binary_function<KeyValuePair<KeyType, ValueType>, KeyValuePair<KeyType, ValueType>, bool> { bool operator() (KeyValuePair<KeyType, ValueType>* pointer1, KeyValuePair<KeyType, ValueType>* pointer2) const { return keyValuePairPointerLessByKey(pointer1, pointer2); } };

template<class KeyType, class ValueType> struct KeyValuePairPointerLessByValue : std::binary_function<KeyValuePair<KeyType, ValueType>, KeyValuePair<KeyType, ValueType>, bool> { bool operator() (KeyValuePair<KeyType, ValueType>* pointer1, KeyValuePair<KeyType, ValueType>* pointer2) const { return keyValuePairPointerLessByValue(pointer1, pointer2); } };

alexdsp avatar Mar 27 '19 00:03 alexdsp

oh - it seems to have to do with this std::binary_function which has been removed in c++17:

https://en.cppreference.com/w/cpp/utility/functional/binary_function

...so, commenting this code out works at the moment? i'm not sure, what i should use instead.. i'll figure this stuff out when moving on to c++17.

RobinSchmidt avatar Mar 28 '19 10:03 RobinSchmidt