How to solve issues related to missing runtime libs on different development machines?

I have been working on a game in C++ for over a year now. Recently I had to change the development machine. As soon as I run the game I get the following error message:

The application was unable to start correctly (0xc000007b). Click OK to close the application.

I have been trying to solve this issue for over a week, many articles on the net state that c runtime libs are missing, other state that there are issues with display drivers, etc. I tried reinstalling the drivers, reinstalling direct x, reinstalling the C runtime, and I could never run/debug the game with visual studio. Does anyone have any idea what should I check?

Any help or idea is highly appreciated.
Is this your game built from source, or just binary you got from somewhere?
If it is your game, then run it under debugger, or attach when it crashes - then examine in what place it crashed.

If it is just binary you got, then it could be runtime/dll issue. And if you cannot attach to it with Visual Studio then it's very likely this is missing/wrong dll problem - you cannot debug process that doesn't start. So download DependencyWalker (or different tool, I use hiew32, but that is commercial tool) that will allow you to examine on which dll files your exe depends and look what's missing. Often this happens because exe is built with debug C/C++ dll runtime, but that is not redistributable and exact same version of Visual Studio must be installed to have same debug dll files. Check if exe depends on msvcr1x0d.dll file. "d" suffix in name is from "debug", "x" can be different digit depending on VS version.

Another option is that your OS is 32-bit, but you are starting 64-bit exe.
Or you have 32 or 64-bit OS, but exe is 32-bit, but it tries to load 64-bit dll file (from same folder, or in PATH).
Obviously this won't work.

Edited by Mārtiņš Možeiko on
Dear Mārtiņš Možeiko...

Thanks for your help...

After running dependency walker, I found that there is one 64 bit dll: MSVCP120D.DLL, and underneath it is the same one but 32 bit. Not sure how that happened, but at least I know the reason for the issue now.

I will have to see how to remove that reference in order to solve the issue.

Thanks again and have a wonderful day.

yours sincerely

mkaatr.


Edit: I placed a 32 bit copy of the dll in the directory and the game worked. So I assume that the default library being used is 64 bit, i must force visual studio to use the 32 bit some how, that seems to be the actual reason for the issue.

Thanks again for your help.

Edited by Mustafa Al-Attar on Reason: Fixed the issue.
Assuming you are using visual studio, uou may want to use the static linking option, if you can:
https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx

/MT will put all those runtime libs IN your executable and save you much hassle. However, any libs you link with may also need to be compiled with /MT. It can be tricky sorting it all out.



Thanks for your advice. I will look into it and see what can I do.

have a nice day.