Issue with the last commit of JUCE Demo


Hello guys !

I have tried to compile the last JUCE Demo on Mac OS X 10.10, but I had an issue at the line 564 with the call of RuntimePermissions::request. I had to replace the [&] with [] to make it compile


That's funny. It's valid C++11 and compiles just fine on Xcode 7.2. I guess you have an older version of Xcode? It's really odd that it would not compile a lambda with a [&] capture  but would happily compile a lambda without. I would be really curious to see the compiler error you are getting.

In any case, I just realised that sharedAudioDeviceManager is a global object, so the [&] capture was redundant anyways. I removed it as you suggested. Thanks for posting. Please update to the newest tip.


Yeah I have XCode 6.4, the error was :

No viable conversion from '(lambda at /Library/.../MainWindow.cpp:564:13)' to 'Callback' (aka 'void (*)(bool)')


Aha. I think that's another bug!

The error means that the macro JUCE_COMPILER_SUPPORTS_LAMBDAS is not defined for your compiler (so the Callback type is defined as a C-style function pointer instead—and lambdas can only be cast to function pointers if they don't capture anything). However obviously Xcode 6.4 does support lambdas and you do use the C++11 flag, and the error tells us that your compiler does know what a lambda is.

So I think perhaps something goes wrong in juce_CompilerSupport.h line 86 for your older version of Xcode. Unfortunately I don't have it here (we're all on Xcode 7.x over here) so can't dig deeper. But I guess there is no need to, as everything works now.


Strange since I use lambdas in XCode 6. Anyway, the problem is solved, and I think I'm going to update my XCode too, thanks !


Yeah, you can use lambdas in Xcode 6, apparently you just can't rely on the JUCE_COMPILER_SUPPORTS_LAMBDAS macro (which we use to surround features using lambdas, so C++98 compilers won't attempt to compile them).