Assertion failure in juce_mac_CoreMidi.cpp:259

Hey all,
I’m trying to navigate my way around writing a simple command line app with Juce. The problem I’m running into is I keep getting an “Assertion failure in juce_mac_CoreMidi.cpp:259” if I try to call
auto midiInputs = MidiInput::getAvailableDevices();

It’s the only line in my main function. Is there something else I need to instantiate first or something?

I’m working on MacOS High Sierra, running XCode 10.1, JUCE 5.4.4.

If you’re writing a command-line app then you need to initialise the message loop for the CoreMidi stuff to work correctly. Add a ScopedJuceInitialiser_GUI object to the top of your main() function which will take care of starting and shutting down the event loop.

Thank you so much, that fixed it.

Out of curiosity, how was I ever supposed to know that? Is there some comprehensive documentation I should be reading that explains basic requirements like that?