1

我正在使用 SDL_mixer 完成关于音频的教程,一切都很顺利。

之后我决定去实验、玩、摸索,所以我做了一个非常相似的程序,有两个声道,让我播放一些视频游戏音乐,并按下按钮播放游戏音效。

然后我开始玩得开心和按动按钮,只是为了愚蠢并测试程序。我开始非常快速地将多个按钮混合在一起,然后在这样做了大约 5 秒后,程序意外关闭。

从大约 2 个月前的那个日期开始,我一直无法在使用 SDL_mixer 的计算机上运行任何东西。我尝试使用 SDL_mixer 创建新项目,我重新下载了所有 SDL 和 SDL_mixer,甚至在 sdl 论坛上提出了这个问题

我正要重新格式化我的整个计算机以使其再次工作,这是 - 不 - 好的。扩展库不应该强迫某人重新格式化,尤其是当这是一个可能会传递给最终用户下载和使用程序的问题时。

我使用的是 Windows 7 64 位;微软 Visual Studio 2012 专业版;C++;和 SDL 1.x

另外,如果有人知道出了什么问题,我该如何解决这个问题,防止它再次发生,并安全地使用声音,这样我就不会在用户的计算机上造成问题?

我用来初始化混音器的行如下:

//Initialize SDL_mixer 
if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 ) 
{ 
    return false; 
}

启动程序后调试器吐出的行并立即关闭:

'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\SDL_Tutorial11.exe'. Symbols loaded. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\SDL.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\SDL_image.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\SDL_ttf.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libfreetype-6.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\zlib1.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\SDL_mixer.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110.dll'. Symbols loaded. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110.dll'. Symbols loaded. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ddraw.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dciman32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ddraw.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\dwmapi.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\setupapi.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\devobj.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\oleaut32.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\cfgmgr32.dll' 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\dciman32.dll' 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KBDUS.DLL'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\KBDUS.DLL' 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KBDUS.DLL'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\KBDUS.DLL' 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dsound.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\powrprof.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dinput.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\hid.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll' 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll' 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\clbcatq.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\MMDevAPI.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\propsys.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\AudioSes.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libmikmod-2.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wdmaud.drv'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ksuser.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\avrt.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msacm32.drv'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msacm32.dll'. Cannot find or open the PDB file. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\midimap.dll'. Cannot find or open the PDB file. 
The thread 0x5b8 has exited with code 0 (0x0). 
The thread 0x1d2c has exited with code 0 (0x0). 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libpng15-15.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libvorbisfile-3.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libvorbis-0.dll'. Module was built without symbols. 
'SDL_Tutorial11.exe' (Win32): Loaded 'C:\Users\Rayne\Documents\Visual Studio 11\Projects\SDL_Tutorial11\Debug\libogg-0.dll'. Module was built without symbols. 
The thread 0x1a1c has exited with code 0 (0x0). 
The thread 0x1fbc has exited with code 0 (0x0). 
The thread 0x3f8 has exited with code 0 (0x0). 
The thread 0x584 has exited with code 0 (0x0). 
The thread 0xa98 has exited with code 0 (0x0). 
The thread 0x182c has exited with code 1 (0x1). 
The thread 0x1d1c has exited with code 1 (0x1). 
The thread 0x1278 has exited with code 1 (0x1). 
The thread 0x1d28 has exited with code 1 (0x1). 
The thread 0x1ca0 has exited with code 1 (0x1). 
The thread 0x1844 has exited with code 1 (0x1). 
The thread 0x1340 has exited with code 1 (0x1). 
The thread 0x6e8 has exited with code 1 (0x1). 
The thread 0x2008 has exited with code 1 (0x1). 
The program '[4852] SDL_Tutorial11.exe' has exited with code 1 (0x1).

PS 有没有一种更简单的方法来表示大段代码,而不必在每行前面手动复制过去 4 个空格?这花了一段时间._.;

4

1 回答 1

1

感谢 genpfault 的建议,我能够找到解决此问题的方法。

事实证明,解决方案是当程序从过载的声道崩溃时,因为必须通过按键激活声音,排队的按键被附加到程序的源代码中,因为 Visual Studio 会自动崩溃后抓住“窗口焦点”并“抓住”多余的字符。

这些字符恰好在程序一开始就被附加到 SDL_mixer 函数的第一个错误检查行之一的字符串文字中,因此它不会为编译器抛出语法错误;错误检查行只是说“不,加载的文件与此字符串不完全匹配,因此关闭程序”,这导致程序在我的断点可以注册并允许我调试之前退出。

终于解决了这个问题,这绝对是一种解脱。

谢谢 genpffault 和 stack-overflow!~

于 2012-12-19T21:48:33.927 回答