2
votes

I am using VS2008 to create a debug version of my application. After compilation, when I try to run the application, I get the famous 'MSVCR90.dll is missing' error.

Initially I tried to copy the MSVCR90.dll from the winsxs folder into the application folder but I get yet another famous error 'application has made an attempt to load the C runtime library incorrectly'

Finally I tried to check the dependency of the application and it revealed something strange to me. There were two MSVCR90 library as dependencies to the application - msvcr90d.dll and msvcr90.dll. I am not how the non-debug version of this library got into my application.

What could I be doing wrong. Thanks in advance.

Here is a picture:

image

dependency walker - no functions visible

1
You could use Dependency Walker to see what functions your application is importing from the msvcr90.dllAri0nhh
Guess: you are linking with an external library that was built in release mode.Richard Critten
I tried to copy the MSVCR90.dll from the winsxs folder into the application folder - don't do this - it is generally a better idea to just install the runtime using the installer. There were two MSVCR90 library as dependencies to the application - msvcr90d.dll and msvcr90.dll - someone (you or a static library) has built something against the release version of the runtime. You will need to run through every library and project to find it. There isn't enough detail to diagnose the source of the mismatch in runtime.Niall
@Ari0nhh I tried do do that, but dependency walker does not show anything other than 'Error opening the specified file' - I'll upload a photo of it.Starfish
@RichardCritten Perhaps you are right. But there are hundreds of libraries(we have both debug/release versions of libraries in different folders). Is there any tool I can use?Starfish

1 Answers

3
votes

I found the answer!

I used the /VERBOSE:LIB linker flag to find out what part of the linking adds the MSVCR90.dll(release) library into my application.

Later used the /NODEFAULTLIB:MSVCRT.lib linker flag to the libs/exe's to avoid the MSVCRT.lib(release) version of the library and enforce 'no-conflict' during the linking. This will avoid two versions of the library reference of MSVCRT in your executable/library.

Note: If you want to avoid the debug version of the MSVCRT in your application, then you can use /NODEFAULTLIB:MSVCRTD.lib