开发者

Ogre program builds but crashes saying "Cannot find or open the PDB file"

开发者 https://www.devze.com 2023-04-11 23:23 出处:网络
#include <OgreRoot.h> #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 #define WIN32_LEAN_AND_MEAN #include \"windows.h\"
#include <OgreRoot.h>

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    #define WIN32_LEAN_AND_MEAN
    #include "windows.h"
#endif

#ifdef __cplusplus
    extern "C" {
#endif

#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
    INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT )
#else
    int main(int argc, char *argv[])
#endif
    {//main
        Ogre::Root* root = new Ogre::Root("plugins.cfg", "ogre.cfg", "Ogre.log");
        delete root;
        return 0;
    }//main
#ifdef __cplusplus
}
#endif

The program builds successfully, but crashes when run, with the following message:

'NavProjectOgre.exe': Loaded 'C:\Ogre\Programs\NavProjectOgre\Debug\NavProjectOgre.exe', Symbols loaded.  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\Ogre\Programs\NavProjectOgre\Debug\OgreMain_d.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\user32.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\gdi32.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\msvcp100d.dll', Symbols loaded.  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\msvcr100d.dll', Symbols loaded.  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\ws2_32.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\advapi32.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\rpcrt4.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\secur32.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\msvcrt.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\ws2help.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\imm32.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\lpk.dll', Cannot find or open the PDB file  
'NavProjectOgre.exe': Loaded 'C:\WINDOWS\system32\usp10.dll', Cannot find or open the PDB file  
First-chance exception at 0x7c812afb in Nav开发者_开发问答ProjectOgre.exe: Microsoft C++ exception: Ogre::FileNotFoundException at memory location 0x0012f46c..  
The program '[4240] NavProjectOgre.exe: Native' has exited with code 0 (0x0). 

Two things struck me:

  1. The int main(int argc, char *argv[]) is supposed to be shown in a dull coloured font by Visual Studio because program control won't reach there, but it's shown in a normal coloured font. Something wrong?
  2. Why is the program crashing when it built successfully?


The solution is to point the project's configuration properties, Debugging, Working Directory to $(OGRE_HOME)\Bin\bin\$(Configuration)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号