Audio device hasn't been opened

I use SDL_mixer and it shows like this
Can anyone tell me the reason why?
thanks everyone

Show the code that you use to start up/initialize SDL_Mixer.

I assume that you’ve executed Mix_OpenAudio() during the startup of the application and before trying to load any music/sound file?

That error comes from Mix_OpenAudio() failing (or memory corruption accidentally writing over the global variable SDL_mixer uses to know that Mix_OpenAudio() already succeeded).

It’s not clear to me why this would happen, but I would double-check this actually called Mix_OpenAudio and that it actually succeeded. (and that Mix_CloseAudio didn’t get called at some point).

(Mix_OpenAudioDevice can be used instead of Mix_OpenAudio, in case that’s what you’re using.)