OpenGL程序在运行时立即关闭

时间:2013-08-13 13:50:35

标签: visual-studio-2010 opengl

我正在使用Visual Studio 10运行OpenGL教程,并且已经看到它可以在其他机器上运行但在我的运行后直接关闭。一个小的空白图像显示窗口会在返回代码之前弹出一瞬间,好像一切顺利。

以下是我得到的输出:

'Tutorials.exe': Loaded 'C:\Users\Nathan\Documents\Visual Studio 2010\Projects\Tutorials\Debug\Tutorials.exe', Symbols loaded.
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Users\Nathan\Documents\Visual Studio 2010\Projects\Tutorials\Debug\glew32.dll', Binary was not built with debug information.
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\opengl32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\glu32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\ddraw.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\dciman32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\setupapi.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\oleaut32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\ole32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\devobj.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\dwmapi.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Users\Nathan\Documents\Visual Studio 2010\Projects\Tutorials\Debug\freeglut.dll', Binary was not built with debug information.
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\winmm.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\uxtheme.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\HsSrv.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\dsound.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\powrprof.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\version.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\atiglpxx.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\atioglxx.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\atiadlxy.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\shell32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\propsys.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\userenv.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\profapi.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\wtsapi32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\psapi.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\IPHLPAPI.DLL', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\winnsi.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\wintrust.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\crypt32.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\msasn1.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\atigktxx.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\aticfx32.dll', Cannot find or open the PDB file
Invalid parameter passed to C runtime function.
Invalid parameter passed to C runtime function.
Invalid parameter passed to C runtime function.
Invalid parameter passed to C runtime function.
'Tutorials.exe': Unloaded 'C:\Windows\SysWOW64\atigktxx.dll'
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\atigktxx.dll', Cannot find or open the PDB file
'Tutorials.exe': Loaded 'C:\Windows\SysWOW64\clbcatq.dll', Cannot find or open the PDB file
The thread 'Win32 Thread' (0xaf0) has exited with code 1 (0x1).
The program '[6208] Tutorials.exe: Native' has exited with code 1 (0x1).

我对这种东西并不好,所以希望有人能够理解这一点。

2 个答案:

答案 0 :(得分:0)

您需要查看函数中传递的参数,因为您的日志正在报告:

传递给C运行时函数的参数无效。

首先你应该在Debug模式下构建它,这样就可以生成PDB文件,你可以实际调试它。

项目属性 - 配置属性 - 链接器 - 调试 - 生成调试信息:是

然后只是调试。正如评论所提到的那样,除了前面提到的那一行之外,这里的输出是没用的。

答案 1 :(得分:0)

我遇到了类似的问题,我可能正在运行相同的教程。

使用调试器并找到程序崩溃的位置。如果是功能

static int FGAPIENTRY FGUNUSED glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }

然后您的GPU可能无法解释此版本的OpenGL。 尝试更新驱动程序,或找到glutInitContextVersion(4,0)并为旧版本的OpenGL提供示例glutInitContextVersion(3,3)的参数。