Explicit specialization of non-template class 'function'

I’m trying to build a project for macOS that I’ve built in Windows with JUCE 5.1
I’ve got XCODE Version 9.0 (9A235), building with LLVM and for latest macOS (10.13)

I get a series of errors starting with:

/JUCE/modules/juce_core/misc/juce_StdFunctionCompat.h:45:11: Explicit specialization of non-template class ‘function’

and all errors that follow.

Anyone got a solution, maybe I’m missing compiler flags?

Have you set the C++ standard to C++11 or newer and your Mac Os deployment target to higher than 10.6? The JUCE replacement for std::function should not even be used by the compiler if you have a new enough compiler and target platform.

I’ve set the deployment target to 10.9 in JUCE and C++ 11 in JUCE C++ Language Standard. SDK is set to default, which I would assume would be 10.13.
Do I need to set the standard anywhere else in Xcode?

Is C++ Library set to LLVM libc++ in the Xcode build configuration settings of the Projucer?


That’s odd. The only way that the juce_StdFunctionCompat.h header will be included is via the following

 #include "../misc/juce_StdFunctionCompat.h"


#if JUCE_CLANG && defined (__has_feature)

  #if (defined (_LIBCPP_VERSION) || ! (JUCE_MAC || JUCE_IOS))


Are you including the JUCE headers in a non-standard way? Can you build any of the example projects?

Hi there,

After major investigation, I found that I have JUCE_PROJUCER_LIVE_BUILD defined in one of my classes this will include that header file.

JUCE_PROJUCER_LIVE_BUILD is not something you should be defining yourself!

Yep, I figured.

Thanks for the help!