VC++ app built in VS2012 crashes when run for the first time, then doesn't crash on subsequent runs
Posted on 2014-11-03
I have a VC++ application that I had been compiling in Visual Studio 2012 on a Windows 7 32-bit machine. The application (.exe) would run fine on whatever machine I tried to run it on. However, I've run into a problem recently. I've ported the code over to a Windows 7 64-bit machine, on which I also have Visual Studio 2012 installed. Ever since I changed machines (from 32-bit to 64-bit), I've noticed something strange (and very irritating). After compiling the .exe file, when I launch this .exe for the FIRST TIME on some other machine, the .exe very often will crash on this FIRST RUN (launch), either immediately after launching the application itself, or when opening an input file just after launching the program. However, when I re-launch this .exe, no more crash. I can generally launch this .exe many many times and still no crash. It's as if something on the machine needed to be initialized by the first program launch. So that after that first program launch (and crash), the .exe is then able to run fine because whatever needed to be initialized HAS INDEED BEEN INITIALIZED (this is just a guess, of course).
This is very frustrating.
There is no message box with any meaningful detail accompanying the crash. Instead, there's just a windows dialog saying "Program XYZ has stopped working. A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available."
This is a tough bug to fix. any help would be GREATLY APPRECIATED!!!!!
Thanks very much.