Exception thrown when exiting program (Ogre3d)

I am getting a weird exception when I exit the program. This has started since today morning and I am ready to pull my hair out. As soon as I exit the program, visual studio gives an exception and stops at line 731 in the file crt0dat.c (see attached screenshot)

I know this is very little to go on. I have tried several different things:

  • un the program without doing anything, that is, not initializing Ogre Core at all. Does not result in a crash
  • Run the program with everything commented out except creating Ogre root (which is related to Ogre itself and has nothing to do with my code), results in the same crash
  • Run the following program which is as basic as it gets, still results in the crash. The crash happens after return 0, when my program has finished running
  • #include "windows.h"
    
    #include "OgreRoot.h"
    
    /// --------------------------------------------
    
    INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)
    {
    
        Ogre::Root* lRoot = new Ogre::Root();
    
        delete lRoot;
        lRoot = NULL;
    
        return 0;
    }
    
    /// --------------------------------------------
    

    Since I have everything on the SVN, I ran the same project on my laptop and it worked without any problems, as well as exited without any problems. This led me to believe that somewhere along the line my visual studio got corrupted. I uninstalled Visual studio, then re-installed it, but the problem persists (When VS installs it goes all over my system. No way to contain it. Does anyone know a surefire way to completely destroy Visual Studio installation?). I am running out of ideas, short of re-installing windows. I hope someone here can be of help.

    Callstack:

      048b0910() 
      ntdll.dll!775d9901()  
      [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll] 
      ntdll.dll!775edc30()  
      ntdll.dll!775edb7c()  
      kernel32.dll!76c67363()  
    > msvcr90d.dll!__crtExitProcess(int status=0)  + 0x1b bytes C
      msvcr90d.dll!doexit(int code=0, int quick=0, int retcaller=0)  + 0x1d1 bytes C
      msvcr90d.dll!exit(int code=0)  + 0x12 bytes C
      OgreFWGame.exe!__tmainCRTStartup()  + 0x2a2 bytes C
      OgreFWGame.exe!WinMainCRTStartup()  + 0xf bytes C
      kernel32.dll!76c63677()  
      ntdll.dll!775d9d42()  
      ntdll.dll!775d9d15()  
    

    Crash Screencapture:
    link text


    That is not how you are supposed to initialize and use Ogre. Most likely the missing initialization work is what causing your crash.

    To get started with ogre I highly recommend following and learning from the tutorials

    Edit: visual studio project templates for ogre can be found here: http://code.google.com/p/ogreappwizards/updates/list to get started quickly.


    Thanks for everybody's help on this problem. I ended up re-installing windows (I tried uninstalling Visual Studio and re-installing it, but something went wrong while uninstalling VS [I followed Microsoft's instructions to the letter] and it would refuse to install again [the setup would crash]). I wish they would make it easy to Uninstall Visual Studio.

    I wasted about 3 days before I resorted to re-installing windows. My advice would be, if you have another computer to continue to do your work on, is to do the same if something like this happens rather than waste days. If you do find a way to fix the problem, please let me know :)


    I recently set ogre up in Visual Studio 2010 and it refused to work right until I copied in the right DLLs - I had been using a set compiled from a slightly older version of ogre in Visual studio 2008. It sounds like the entire ogre compilation or the DLLs may have been copied over via the SVN which could cause strange problems.

    Hope it helps, anyway.

    链接地址: http://www.djcxy.com/p/17106.html

    上一篇: 程序如何流动

    下一篇: 退出程序时抛出异常(Ogre3d)