0

I'm working on a project with Visual Studio 2017. Everything works fine from within Visual Studio.

When I try to run the .exe produced by the compilation the program aborts. I think it has something to do with the dlls.

Is there a way to see exactly what Visual Studio is doing to get the executable to run properly, can I somehow see a command line equivalent of what Visual Studio is doing with the executable?

It's an opencv C++ project if that's of any relevance.

Miki
  • 40,887
  • 13
  • 123
  • 202
Danny Ibrahim
  • 87
  • 1
  • 12

1 Answers1

1

When you start debugging from Visual Studio by default current working directory is the folder where project file (.vcxproj) is located. When you start the app from command line or Windows Explorer current working directory is where the .exe is. So, to test if this is the problem make a shortcut that starts the .exe but set working directory in the shortcut to where the project file is. OR change the working folder in Visual Studio to where the .exe is (Project properties > Configuration Properties > Debugging > Working Directory)

Another difference between debugging and running is the heap. See this question for more details on that.

To see which dll's are being loaded, from where, and in which order use Process Monitor from Sysinternals Suite. If some dll is missing the log will show that Windows tried to load it from every possible directory in PATH, and also current working directory, and failed.

Dialecticus
  • 16,400
  • 7
  • 43
  • 103