Program crash on external test environment - C ++

I have a program that starts fantastically when launched from Visual Studio 2010 Express, but when it is built and pulled out, it has problems. I installed the external test environment in the same way as when I started it from Visual Studio, so this should not be a problem. I want to attach it to .exe to see where the crash occurred, but I don't have versions other than Express.

Any suggestions? Why does the program crash due to the environment of VS ++ 2010 Express, but it works fine inside.

I would post the code, but this is a huge project, not a line that will throw an error.

Thank you so much for your time.

+5
source share
5 answers

It is very difficult to know for sure, not knowing what an accident is, but a few common problems that can cause this:

  • Environment variables do not match. Perhaps you are relying on something in vcvars32.bat in a test environment.
  • The PATH environment variable does not match and you get some bad or incompatible DLL.
  • Your code somehow depends on the current working directory, which is the one that starts from Visual Studio.
+2
source

Wikipedia for salvation ?

. . , , , , . , , , , , .

, User32.dll , , . .

+2

, Windows. , chm, . :

  • , PDB - .
  • : windbg -p <PID>. , , windbg -g foo.exe.
  • .
  • Microsoft, : .sympath x:\YourPathToPDBs; SRV*x:\symbols*http://msdl.microsoft.com/download/symbols
  • , : .reload
  • , k .

, . , , chm MSDN . - dv, . , .lines, k kb.

+2

catch try. excepcion, .

exe , , .

PS: *.pdb EXE , .

0

, , ( ), , .

Visual Studio ( "CWD" ).

Visual ++ Solution/Project :

Solution     <- the location of your solution file
  Debug      <- where the Debug executables end up
  Release    <- where the Release executables end up
  Project    <- the location of your project file
    Debug    <- where Debug intermediate files end up
    Release  <- where Release intermediate files end up

Studio, " ", " ", CWD , Solution\Project.

However, when you perform an appearance by simply double-clicking the application, CWD is the application directory ( Solution\Debugfor example).

If you try to open a file from the current directory (what happens when you do std::ifstream ifstr("myfile.txt")), whether it will be successful depends on where you were when you started the application.

0
source

All Articles