gpt4 book ai didi

c++ - SDL_Mixer 崩溃一次;现在所有使用 SDL_Mixer 的程序都会在初始化时崩溃

转载 作者:太空宇宙 更新时间:2023-11-04 12:01:24 25 4
gpt4 key购买 nike

我正在浏览 this tutorial使用 SDL_mixer 在音频上一切正常。

在那之后,我决定通过探索进行实验、玩耍和学习,所以我制作了一个非常相似的程序,有两个声道,让我播放一些视频游戏音乐,并按下按钮播放游戏音效。

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

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

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

我使用的是 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).

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

最佳答案

多亏了 genpfault 的建议,我才能够找到解决这个问题的方法。

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

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

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

谢谢 genpffault 和 stack-overflow!~

关于c++ - SDL_Mixer 崩溃一次;现在所有使用 SDL_Mixer 的程序都会在初始化时崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13959671/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com