I’ve been trying to build code developed by my team on MacOSM1 architecture using xCode 12.4.
Mac is running BigSur version 11.2.3. I’ve tried this with JUCE 6.0.6, 6.0.7, 6.0.8 and the develop branch. Each time I try to build for a Release target the following build error occurs:
In XCode file->project->build system is set to “New Build System Default”
Use of undeclared identifier 'objc_msgSend_fpret' juce_osx_ObCHelpers.h
Are you sure that the project is using your upgraded version of JUCE and not one that is part of the project?
I had exactly the same error because I was trying to build one of my old plugins for M1, and the Projucer project was set up such that it was using the JUCE modules that are included in the repo (I have it set up like this in order to simplify building Windows and Linux versions on Azure Pipelines).
As soon as I made sure that the Projucer project was actually picking up the latest version of JUCE then that error went away.
I am trying to update a midi app I wrote a few years ago, and compile with Xcode for M1 Mac.
I may well be doing something stupid as I’m not a regular coder and I’ve forgotten much of what I knew when I wrote the app.
I have installed Juce 6 and updated my project with the projucer but Xcode throws a spurious error, that has me completely confused.
the code Xcode objects to is longstanding boilerplate virtual midi output code:
void MidiIO::makeMainOut()
{
delete mainOutput; //close old output // is this needed?
//create virtual midi out
mainOutput = MidiOutput::createNewDevice ("MantaMainOut");
if (mainOutput != nullptr)
{
deviceManager.setDefaultMidiOutput("MantaMainOut");//what does default do anyway?
cout << "created MantaOut main out \n";
}
else
cout << "failed to create main out \n";
}
the error is:
Assigning to 'juce::MidiOutput *' from incompatible type 'std::unique_ptr<MidiOutput>'
Some parts of JUCE’s API have changed in the past couple of years. The error is telling you that the return type of MidiOutput::createNewDevice isn’t assignable to the type of mainOutput. To resolve the issue, you probably need to update the type of mainOutput to be a std::unique_ptr<juce::MidiOutput>.
There’s no examples in the JUCE repo, but it should be as simple as changing MidiOutput *mainOutput; to std::unique_ptr<MidiOutput> midiOutput;. You would then need to remove any calls to delete mainOutput as the unique_ptr will handle this automatically.