‘MIX_INIT_MP3’ was not declared in this scope,这是什么情况?

使用SDL_Mixer写例程,程序才到初始化就进行不下去了,代码如下:

   int nFlag=MIX_INIT_MP3;
   int nRet=Mix_Init(nFlag);
   if(nRet&nFlag!=nFlag)
      return false;

报错信息是:

‘MIX_INIT_MP3’ was not declared in this scope

NND,按官方手册写的代码也报错?还是低级错。这不是坑爹吗?在SDL_Mixer.h里找了半天也没有关于MIX_INIT_MP3和Mix_Init的声明,什么情况?

放狗一查,果然有倒霉孩子和我一样,原文如下:

“I just noticed that on my Ubuntu 9.10 system, the SDL 1.2.8 version of SDL_mixer does not define Mix_Init() or Mix_Quit(). However with SDL 1.2.10, it does. Here's the SDL_mixer.h header file with version 1.2.10:
http://svn.euclids-dream.com/repos/g...DL/SDL_mixer.h

大意是利用UBUNTU9.10新立得软件包管理器安装的SDL_mixer是1.2.8版,而Mix_Init和MIX_INIT_MP3出现在1.2.10版中。原文中还给出了1.2.10版SDL_mixer.h的查看地址。

签于本人用的是UBUNTU10.04,于是乎赶紧查了一下本机的SDL_mixer版本,果然也是1.2.8版。问题找到后就好解决了,删除这段代码,直接Mix_OpenAudio,照样能加载播放MP3文件。

posted @ 2011-05-06 01:05  lykyl的自留地  阅读(1245)  评论(0编辑  收藏  举报