游戏开发论坛

 找回密码
 立即注册
搜索
查看: 2534|回复: 2

DEBUG模式转RELEASE模式的问题

[复制链接]

16

主题

59

帖子

59

积分

注册会员

Rank: 2

积分
59
发表于 2011-9-27 03:35:00 | 显示全部楼层 |阅读模式
很早以前做的一个OGRE程序 在DEBUG模式下可以运行 但是在RELEASE模式下编译通过 但是运行就会报错

Unhandled exception at 0x635eee58 (msvcr90d.dll) in OgreFramework.exe: 0xC0000005: Access violation reading location 0x6766632e.

在Project-&gtroperties->Linker->Input->Additional Dependencies中 已经分别加了 -d.lib 和 .lib
Working Directory 指向了OgreSDK/bin/debug 和 release
VC++ Directories 中也分别加入了include lib

在DEBUG模式会生成log文件 但是在RELEASE模式不会 是不是因为没有成功运行过的原因?

后来发现在RELEASE模式下调试信息中有

OgreFramework.exe': Loaded 'D:\Windows\System32\winspool.drv'
'OgreFramework.exe': Loaded 'D:\Windows\System32\mpr.dll'
'OgreFramework.exe': Loaded 'D:\Windows\System32\imm32.dll'
'OgreFramework.exe': Loaded 'D:\Windows\System32\msctf.dll'
First-chance exception at 0x635eee58 (msvcr90d.dll) in OgreFramework.exe: 0xC0000005: Access violation reading location 0x6766632e.
Unhandled exception at 0x635eee58 (msvcr90d.dll) in OgreFramework.exe: 0xC0000005: Access violation reading location 0x6766632e.

对应的在DEBUG模式下

'OgreFramework.exe': Loaded 'D:\Windows\System32\winspool.drv'
'OgreFramework.exe': Loaded 'D:\Windows\System32\mpr.dll'
'OgreFramework.exe': Loaded 'D:\Windows\System32\imm32.dll'
'OgreFramework.exe': Loaded 'D:\Windows\System32\msctf.dll'
'OgreFramework.exe': Loaded 'C:\dev\OgreSDK\bin\debug\RenderSystem_Direct3D9_d.dll'
'OgreFramework.exe': Loaded 'D:\Windows\System32\d3d9.dll'

也就是说我RELEASE模式下的RenderSystem_Direct3D9.dll导入失败了?

更可以的是 在RELEASE模式下的调试信息中 居然有

'OgreFramework.exe': Loaded 'C:\dev\OgreSDK\bin\release\NxOgre_Debug.dll'
'OgreFramework.exe': Loaded 'C:\dev\OgreSDK\bin\release\OgreMain_d.dll'

他们应该调用的是NxOfre.dll 和OgreMain.dll啊?

就像我前面说的各种设置都设置好了 实在想不出还有哪有问题 哪位大侠帮帮忙 或者说说自己的意见

16

主题

59

帖子

59

积分

注册会员

Rank: 2

积分
59
 楼主| 发表于 2011-9-27 04:03:00 | 显示全部楼层

Re:DEBUG模式转RELEASE模式的问题

又追踪了一下程序 发现问题可能出现在这段代码上

initOgre(Ogre::String wndTitle, OIS::KeyListener *pKeyListener, OIS::MouseListener *pMouseListener){
Ogre:ogManager* logMgr = new Ogre::LogManager();

m_pLog = Ogre::LogManager::getSingleton().createLog("Log.log",true, true, false);
m_pLog->setDebugOutputEnabled(true);
m_pRoot = new Ogre::Root();

m_pRoot->showConfigDialog();
m_pRenderWnd = m_pRoot->initialise(true,wndTitle);
       
unsigned long hWnd = 0;
OIS:aramList paramList;
m_pRenderWnd->getCustomAttribute("WINDOW", &hWnd);

paramList.insert(OIS::ParamList::value_type("WINDOW", Ogre::StringConverter::toString(hWnd)));

m_pInputMgr = OIS::InputManager::createInputSystem(paramList);

m_pKeyboard = static_cast<OIS::Keyboard*>(m_pInputMgr->createInputObject(OIS::OISKeyboard, false));
m_pMouse = static_cast<OIS::Mouse*>(m_pInputMgr->createInputObject(OIS::OISMouse,true));

m_pMouse->getMouseState().height = m_pRenderWnd->getHeight();
m_pMouse->getMouseState().width = m_pRenderWnd->getWidth();

if(pKeyListener == 0)
        m_pKeyboard->setEventCallback(this);
else
        m_pKeyboard->setEventCallback(pKeyListener);

if(pMouseListener == 0)
           m_pMouse->setEventCallback(this);
else
        m_pKeyboard->setEventCallback(pKeyListener);

在DEBUG模式下所有变量都有正确的赋值 但是在RELEASE模式下 m_pKeyboard m_pMouse都是空指针 所以在最后的局域试图调用m_pKeyboard->setEventCallback(pKeyListener);的时候会报错 但是为什么会有这样的结果?

16

主题

59

帖子

59

积分

注册会员

Rank: 2

积分
59
 楼主| 发表于 2011-9-27 04:14:00 | 显示全部楼层

Re:DEBUG模式转RELEASE模式的问题

再上一层是Framework::getSingletonPtr()->initOgre("E84App",0,0);
会不会是getSingletonPtr()的原因啊?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2025-6-9 10:22

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表