Debugging issues with MSVCR90.DLL

Posted by Matt | Filed under , , ,

When we first migrated our applications from Microsoft Visual C++ 6 to Microsoft Visual Studio 2008, we received the following messages when trying to run our debug builds in the debugger:

This application has failed to start because MSVCR90.dll was not found.  Re-installing the application may fix this problem.

At first, it didn't make sense.  We looked for MSVCR90.dll and it was properly installed in the Side-by-side (SxS) system folders.  Our release version would also run fine and that used the same DLL.

Then it hit me:  why is it looking for MSVCR90.DLL while running debug?  Shouldn't it be looking for MSVCR90D.DLL?

A quick look using Dependency Walker (one of the best developer's utilities ever created) showed me that we were linking to both MSVCR90D.DLL and MSVCR90.DLL.

The solution is to ignore MSVCR90 (and if necessary, MSVCRT) when linking.  This can be done from the project properties:

image

But only do this for the debug configurations.  Once you do this, re-link, and your application should start.  If you continue to get this same error message, then using Dependency Walker again, check that some of your DLLs don't need the same modification.  In addition, if you attempt to do a LoadLibrary() on one of your DLLs and you're getting a cryptic message about the DLL not being found, it may be the same thing.  Use Dependency Walker on that DLL and modify those projects if necessary.

Thinking back, when linking using Visual C++ 6, I remember some linker messages like the following which (at the time) I thought was safe to ignore.

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library

Maybe in the good 'ole days, we could ignore such a message.  Today, we're not so lucky.

BTW, Microsoft, please make a better error message for such a situation.

Comments

October 9, 2008 15:47

suneel

thanks for this great tip, my application was using another dll which i compiled from the openCV source on xp64. In this there was a project highgui which was linking itself to the msvcr90.dll.

i followed your tip of using the dependency viewer and recompiled the highgui in opencv with the ignore and it linked the highguid.lib to my app and it worked! phew!!

just like you i also was having this problem only in debug mode.

suneel United States

October 23, 2008 02:00

ryan

try to create the project in a NTFS drive but not FAT32 drive.

ryan

October 23, 2008 03:53

matt

My computer uses nothing but NTFS drives.

matt Canada

October 24, 2008 21:22

Ned Nik

thanks alot for the insight, I knew that was my problem too Smile

Ned Nik Romania

November 17, 2008 03:15

rich

What if your main program is in debug but it links to a library compiled in release mode? With the 'ignore library' thing, now it won't link. I'm so glad I mostly use C# now - I can spend my time actually developing rather than banging my head against the wall with stupid issues like this.

rich United States

November 28, 2008 23:04

Wansong Li

Thanks for this great tip. It took me 1 day to solve this problem. Before I saw this page, I almost give up.

Wansong Li Germany

December 13, 2008 15:11

gizmocuz

A small warning like:

msvcrtd.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library

Could also be the originator of this problem. Ignoring msvcrt.lib and doing a full rebuild solved this.

Thanks a lot!!!

gizmocuz Netherlands

May 13, 2009 00:33

StuTheDog

Thanks a bunch for this, been working in C# for so long I've forgotten a lot of the pecularalities of CPP.

StuTheDog United States

May 20, 2009 07:12

Emergay Blanleet

Wow thanks a lot man, this really helped me out!

Emergay Blanleet Syria

May 20, 2009 07:13

Emergay Blanleet

O btw Emergay Blanleet is not my real name, and I'm not from Syria!

Emergay Blanleet Syria

Comments are closed