Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
SDL2_混频器在mac上初始化失败(运行时)_C_Macos_Sdl 2 - Fatal编程技术网

SDL2_混频器在mac上初始化失败(运行时)

SDL2_混频器在mac上初始化失败(运行时),c,macos,sdl-2,C,Macos,Sdl 2,在mac上使用Sdl2有困难。 代码编译良好,但在运行时Mix_init失败,出现以下错误: OGG Support Not Available 奇怪的是,我安装了sdl2_混合器,如下所示: brew install SDL2_mixer --with-libvobis 这是初始化的代码 int flags = MIX_INIT_OGG; int initted = Mix_Init(flags); if ((initted & flags) != flags) { pri

在mac上使用Sdl2有困难。 代码编译良好,但在运行时Mix_init失败,出现以下错误:

OGG Support Not Available
奇怪的是,我安装了sdl2_混合器,如下所示:

brew install SDL2_mixer --with-libvobis
这是初始化的代码

int flags = MIX_INIT_OGG;
int initted = Mix_Init(flags);
if ((initted & flags) != flags)
{
    printf("Mix_Init: Failed to init SDL_Mixer\n");
    printf("Mix_Init: %s\n", Mix_GetError());
    MSG_EXIT("Exiting ",1);
}

好了,现在请大家回答。看起来这不是一个常见错误。挖掘之后,SDL2_混频器似乎在MacOs上无法正常工作。 我使用了SDL2_mixer-1.2,它还可以。当然,我需要修改一点代码。 幸运的是,只需要更改初始化。所有功能在mixer1.2和mixer2中都是相同的。 然而,有一些小事情要做。 -卸下sdl_混合器(如果已安装) -安装其他依赖项 -重新安装sdl_混合器 请勿卸下SDL2_混合器。 我不知道它是如何工作的,为什么我不应该删除它,我只是意识到当我删除它时,我还有其他疯狂的错误,即使我编译了wil-lsdl_混音器和not-lsdl2_混音器

以下是brew命令

brew install sdl_mixer --with-libvorbis    
brew uninstall libvorbis libogg //it may ask you de remove sdl_mixer
然后

希望它能帮助别人

brew install sdl sdl_image sdl_ttf portmidi hg git
brew reinstall sdl_mixer --with-libvorbis