tags:

views:

130

answers:

3

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:

  1. un the program without doing anything, that is, not initializing Ogre Core at all. Does not result in a crash
  2. 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
  3. 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

+1  A: 

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.

Charles
I have actually tried the first tutorial from the wiki, copy pasted into a new project (after downloading the demo files), linked it up properly, and ran that project. It runs, then gives the same exact exception when I quit.
Samaursa
A: 

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.

Toeofdoom
Thanks for the answer :) I ended up re-installing windows, I could not get to the root of the problem and it successfully wasted 2 days of productivity (well, not entirely, but uninstalling/repairing/reinstalling takes away time). If anybody comes across this issue, with any SDK, save yourself some time and reinstall windows. I have a decent setup where everything is on the server, so reinstall of windows and programs did not take more than a few hours.
Samaursa
A: 

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 :)

Samaursa