Xcode 11.4 was just released and my machine happily auto updated it for me.
Now everything is busted. Most juce projects no longer compile. Example trying to build Projucer:
/Users/rrabien/dev.github/roli_juce/extras/Projucer/Source/ComponentEditor/UI/jucer_RelativePositionedRectangle.h:738:5: Reference to 'Point' is ambiguous
/Users/rrabien/dev.github/roli_juce/extras/Projucer/Source/CodeEditor/jucer_ItemPreviewComponent.h:61:61: Reference to 'Point' is ambiguous
/Users/rrabien/dev.github/roli_juce/extras/Projucer/Source/ComponentEditor/UI/jucer_RelativePositionedRectangle.h:743:16: Reference to 'Point' is ambiguous
/Users/rrabien/dev.github/roli_juce/extras/Projucer/Source/Application/jucer_MainWindow.cpp:815:9: Reference to 'Point' is ambiguous
/Users/rrabien/dev.github/roli_juce/extras/Projucer/Source/ComponentEditor/PaintElements/jucer_PaintElementPath.cpp:235:43: Reference to 'Point' is ambiguous
Another issue I’m having is my Windows builds are failing with:
1>d:\a\cloud\cloud\modules\JUCE\modules\juce_core\containers\juce_ArrayBase.h(155): error C2220: the following warning is treated as an error
1>d:\a\cloud\cloud\modules\JUCE\modules\juce_core\containers\juce_ArrayBase.h(155): warning C4723: potential divide by 0
1>d:\a\cloud\cloud\modules\JUCE\modules\juce_core\containers\juce_ArrayBase.h(155): warning C4723: potential divide by 0
1>d:\a\cloud\cloud\modules\JUCE\modules\juce_core\containers\juce_ArrayBase.h(155): warning C4723: potential divide by 0
Which really doesn’t make any sense since there is no division on that line.
In those cases it was caused by users of juce including system headers after the juce headers. Now juce itself will not compile, i.e I can’t compile the ProJucer in the tip of develop.
For what it is worth, I did a test and found that the latest Visual Studio “divide by 0” message happens only in Release mode. In Debug mode it compiles clean, and runs. This is on one of my projects using JUCE, and Tracktion Engine.
And the error points to line 272 in juce_Image.cpp,
also seeing reference to 'AudioBuffer' is ambiguous:
Showing Recent Messages
CompileC /Users/jon/Library/Developer/Xcode/DerivedData/Instrument_Designer-barakqamhsrvrmcbiilmlplpelws/Build/Intermediates.noindex/Instrument\ Designer.build/Debug/Instrument\ Designer\ -\ AUv3\ AppExtension.build/Objects-normal/x86_64/include_juce_audio_plugin_client_AUv3.o /Users/jon/git/InstrumentDesigner/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/jon/git/InstrumentDesigner/Builds/MacOSX
export LANG=en_US.US-ASCII
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -target x86_64-apple-macos10.11 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c++1z -stdlib=libc++ -fobjc-weak -fapplication-extension -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Wunreachable-code -Wno-implicit-atomic-properties -Wno-objc-interface-ivars -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wnon-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -Wno-c++11-extensions -D_DEBUG=1 -DDEBUG=1 -DJUCE_USE_CUSTOM_PLUGIN_STANDALONE_APP=1 -DNO_JUCE_ENABLE_LIVE_CONSTANT_EDITOR=1 -DGL_SILENCE_DEPRECATION=1 -DUSE_TWO_FILTERS=1 -DJUCE_COREGRAPHICS_DRAW_ASYNC=1 -DNO_VOICE_ANIMATIONS=1 -DJUCE_COREGRAPHICS_RENDER_WITH_MULTIPLE_PAINT_CALLS=1 -DNO_OPENGL_RENDERING=1 -DJUCE_DISABLE_COREGRAPHICS_FONT_SMOOTHING=1 -DUSE_BOOST_CHEBY=1 -DJUCER_XCODE_MAC_F6D2F4CF=1 -DJUCE_APP_VERSION=1.0.22 -DJUCE_APP_VERSION_HEX=0x10016 -DJucePlugin_Build_VST=0 -DJucePlugin_Build_VST3=0 -DJucePlugin_Build_AU=0 -DJucePlugin_Build_AUv3=1 -DJucePlugin_Build_RTAS=0 -DJucePlugin_Build_AAX=0 -DJucePlugin_Build_Standalone=0 -DJucePlugin_Build_Unity=0 -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -g -fvisibility-inlines-hidden -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -index-store-path /Users/jon/Library/Developer/Xcode/DerivedData/Instrument_Designer-barakqamhsrvrmcbiilmlplpelws/Index/DataStore -I/Users/jon/git/InstrumentDesigner/Builds/MacOSX/build/Debug/include -I../../Vendor/JUCE/modules/juce_audio_processors/format_types/VST3_SDK -I../../Vendor/VST2_SDK -I../../JuceLibraryCode -I../../Vendor/ffGuiAttachments -I../../Vendor/juce-toys -I../../Vendor/JUCE/modules -I/usr/local/include -I../../Vendor/JUCE/modules/juce_audio_plugin_client -I/Users/jon/Library/Developer/Xcode/DerivedData/Instrument_Designer-barakqamhsrvrmcbiilmlplpelws/Build/Intermediates.noindex/Instrument\ Designer.build/Debug/Instrument\ Designer\ -\ AUv3\ AppExtension.build/DerivedSources-normal/x86_64 -I/Users/jon/Library/Developer/Xcode/DerivedData/Instrument_Designer-barakqamhsrvrmcbiilmlplpelws/Build/Intermediates.noindex/Instrument\ Designer.build/Debug/Instrument\ Designer\ -\ AUv3\ AppExtension.build/DerivedSources/x86_64 -I/Users/jon/Library/Developer/Xcode/DerivedData/Instrument_Designer-barakqamhsrvrmcbiilmlplpelws/Build/Intermediates.noindex/Instrument\ Designer.build/Debug/Instrument\ Designer\ -\ AUv3\ AppExtension.build/DerivedSources -Wreorder -F/Users/jon/git/InstrumentDesigner/Builds/MacOSX/build/Debug -Wall -Wshadow-all -Wshorten-64-to-32 -Wstrict-aliasing -Wuninitialized -Wunused-parameter -Wconversion -Wsign-compare -Wint-conversion -Wconditional-uninitialized -Woverloaded-virtual -Wreorder -Wconstant-conversion -Wsign-conversion -Wunused-private-field -Wbool-conversion -Wextra-semi -Wunreachable-code -Wzero-as-null-pointer-constant -Wcast-align -Winconsistent-missing-destructor-override -Wshift-sign-overflow -Wnullable-to-nonnull-conversion -Wno-missing-field-initializers -Wno-ignored-qualifiers -MMD -MT dependencies -MF /Users/jon/Library/Developer/Xcode/DerivedData/Instrument_Designer-barakqamhsrvrmcbiilmlplpelws/Build/Intermediates.noindex/Instrument\ Designer.build/Debug/Instrument\ Designer\ -\ AUv3\ AppExtension.build/Objects-normal/x86_64/include_juce_audio_plugin_client_AUv3.d --serialize-diagnostics /Users/jon/Library/Developer/Xcode/DerivedData/Instrument_Designer-barakqamhsrvrmcbiilmlplpelws/Build/Intermediates.noindex/Instrument\ Designer.build/Debug/Instrument\ Designer\ -\ AUv3\ AppExtension.build/Objects-normal/x86_64/include_juce_audio_plugin_client_AUv3.dia -c /Users/jon/git/InstrumentDesigner/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm -o /Users/jon/Library/Developer/Xcode/DerivedData/Instrument_Designer-barakqamhsrvrmcbiilmlplpelws/Build/Intermediates.noindex/Instrument\ Designer.build/Debug/Instrument\ Designer\ -\ AUv3\ AppExtension.build/Objects-normal/x86_64/include_juce_audio_plugin_client_AUv3.o
In file included from /Users/jon/git/InstrumentDesigner/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm:9:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_AUv3.mm:27:
../../Vendor/JUCE/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm:1133:9: error: reference to 'AudioBuffer' is ambiguous
AudioBuffer<float> scratchBuffer;
^
In file included from /Users/jon/git/InstrumentDesigner/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm:9:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_AUv3.mm:27:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm:61:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreAudioKit.framework/Headers/CoreAudioKit.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreAudioKit.framework/Headers/AUGenericView.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h:11:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AudioUnit.framework/Headers/AUComponent.h:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUComponent.h:65:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioComponent.h:167:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioTypes.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioBaseTypes.h:147:29: note: candidate found by name lookup is 'AudioBuffer'
typedef struct AudioBuffer AudioBuffer;
^
In file included from /Users/jon/git/InstrumentDesigner/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm:9:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_AUv3.mm:27:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm:59:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/AU/../utility/juce_IncludeModuleHeaders.h:27:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/AU/../utility/../juce_audio_plugin_client.h:55:
In file included from ../../Vendor/JUCE/modules/juce_audio_basics/juce_audio_basics.h:86:
../../Vendor/JUCE/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h:80:7: note: candidate found by name lookup is 'juce::AudioBuffer'
class AudioBuffer
^
In file included from /Users/jon/git/InstrumentDesigner/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm:9:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_AUv3.mm:27:
../../Vendor/JUCE/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm:1560:24: error: reference to 'AudioBuffer' is ambiguous
void processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiBuffer) noexcept
^
In file included from /Users/jon/git/InstrumentDesigner/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm:9:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_AUv3.mm:27:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm:61:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreAudioKit.framework/Headers/CoreAudioKit.h:14:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreAudioKit.framework/Headers/AUGenericView.h:17:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AudioUnit.framework/Headers/AudioUnit.h:11:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AudioUnit.framework/Headers/AUComponent.h:1:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AUComponent.h:65:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/AudioToolbox.framework/Headers/AudioComponent.h:167:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioTypes.h:8:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/CoreAudioTypes.framework/Headers/CoreAudioBaseTypes.h:147:29: note: candidate found by name lookup is 'AudioBuffer'
typedef struct AudioBuffer AudioBuffer;
^
In file included from /Users/jon/git/InstrumentDesigner/JuceLibraryCode/include_juce_audio_plugin_client_AUv3.mm:9:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/juce_audio_plugin_client_AUv3.mm:27:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/AU/juce_AUv3_Wrapper.mm:59:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/AU/../utility/juce_IncludeModuleHeaders.h:27:
In file included from ../../Vendor/JUCE/modules/juce_audio_plugin_client/AU/../utility/../juce_audio_plugin_client.h:55:
In file included from ../../Vendor/JUCE/modules/juce_audio_basics/juce_audio_basics.h:86:
../../Vendor/JUCE/modules/juce_audio_basics/buffers/juce_AudioSampleBuffer.h:80:7: note: candidate found by name lookup is 'juce::AudioBuffer'
class AudioBuffer
^
2 errors generated.
update: fully qualifying 3 separate instances of juce::AudioBuffer gets me building but i hit this:
Undefined symbols for architecture x86_64:
"createPluginFilterOfType(juce::AudioProcessor::WrapperType)", referenced from:
StandalonePluginHolder::createPlugin() in libInstrument Designer.a(StandaloneApp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I can repro the AudioBuffer and Point ambiguities, but not the linking issue. createPluginFilterOfType is now an inline function, included via juce_StandaloneFilterWindow.h. Make sure that you’re including the version of StandaloneFilterWindow.h from JUCE itself, and that you’re not using a duplicate that you’ve copied somewhere. The include should look like this:
This is a sweet update. Removing the dependancy on MacTypes.h has also fixed a load of Declaration shadows a variable in the global namespace warnings we had.
Unfortunately this fix leads to “Point is ambiguous” errors in my own code and leaves me puzzled as to why. Could you explain how you could avoid MacTypes.h?
My code does some trickery with OSX CGContext to render graphics to a pdf file. My .mm file starts with:
I use a pure function to create a juce::CoreGraphicsContext and need to call a few CGContex… routines to set up rendering to a pdf file.
This now immediately leads to “Point is ambiguous”, but used to work before this fix. I guess the problem is caused by the using namespace juce; in JuceHeader.h.
How can Juce itself avoid the issue? It certainly needs to include CoreGraphics.h at some point.
After this fix, the only Point that should be made visible by the JUCE headers is juce::Point. There’s not much JUCE can to do to prevent ambiguities between juce::Point and global Point if MacTypes.h is included in user code (JUCE is already doing the right thing by namespacing Point).
What happens if you just switch the order of the includes there, so that the juce header is included before the system one? That should fix any ambiguities that arise in the JUCE header. However, that won’t fix issues in your own code, if you refer to Point without explicit namespace qualification. In any TU where both Point and juce::Point are visible, the right thing to do is to explicitly qualify juce::Point when you mean juce::Point.
Thank you for the quick reply! Juce is not doing the totally right thing as it has using namespace juce; in JuceHeader.h and that’s why the juce::Point vs mac Point problem occurs. I know it can be disabled, but for now that would be a very hard change to make for me. Unfortunately c++ knowns no way of temporarily undoing a using namespace juce;
The only reason I include CoreGraphics.h is to make juce_mac_CoreGraphicsContext.h compile, so I can’t change the order. I am not using Point in my code, only CGContext… calls. The problem happens during the include.
Update: ok I was able to make things work again by indeed shuffling around include orders. It boiled down to make sure no #include “JuceHeader.h” happens before the #include “CoreGraphics/CoreGraphics.h”. Thanks for the hint!
Did we ever disable that using namespace juce by default? If we haven’t done so, we should, and should probably deprecate it more aggressively too.
If you’re having that kind of problem in your code, the thing to do is to turn off juce’s using namespace juce and instead add your own using, which you can put AFTER all your headers, or inside your own namespace, so it can’t interact with any headers from the system or other libraries.