views:

22065

answers:

6

I know a question like this was already asked, but the situation is a little different, and all the answers on that problem didn't work for me.

I'm trying to compile some C code in VS2008 and it doesn't create an exe. Also, when I try to run it with f5, I get:

This application has failed to start because MSVCR90.DLL was not found.

I did some googling and it said that this was because my c++ redistributable package wasnt installed. So I installed that, restarted everything and tried again. But alas, I still get the same error. Does anyone have any clue how to fix this?

+2  A: 

It sounds like either a problem with your VS2008 installation, or something wrong with your DLL search path. MSVCR90.DLL is installed when you install VS2008, you shouldn't have to install any additional redistributable packages.

First I would check your PATH environment variable and make sure there is no gobbledydook in it that will break some of the entries, and if you don't find a problem there, then I would uninstall and reinstall Visual Studio.

You could also try searching for MSVCR90.DLL (and other DLLs like it), and move them to your Windows/System32 folder.

If you just want to get going now, another thing you could do is change your project to statically link to the runtime libraries, and then it wont even try to load that DLL. Go to your Project settings, Configuration Properties->C/C++->Code Generation and change Runtime Library from Multi-Threaded DLL to just Multi-Threaded (or any of the options that doesn't end with DLL).

Gerald
+4  A: 

Here are some things to check for your configuration of the project- under the general tab:

  • .1 Configuration type - exe in your case.
  • .2 Use of MFC: if this is an MFC application it might be more portable if you do: Use MFC in a static library.
  • .3 Use of ATL - if not using atl (or not sure) say Not using ATL.
  • .4 Under C/C++ -> Runtime Library: Say Multi-threaded Debug (for debug version) or Multi-Threaded (for release version).

If you are getting specific linker errors that say something is already defined: This means that you have some parts of your app (separate libs being linked to your exe) that are built with different runtime linking:

You can:

  • Make sure that these libraries were compiled with the same version of visual studio as your application.

  • Change those projects to use static runtime: C/C++ -> Code Generation -> Runtime LIbrary: /MT or MTd (same as #4 above)

  • If you still have some specific errors try telling the linker to ignore certain libraries: Go to Linker->Ignore Specific Library and put in the library that you want to ignore. This is most common for 'libcmt.lib' or 'libcmtd.lib'. It is important also to know that lib ending with 'd' is usually the debug version. If you are creating a release build and you are getting 'already defined in libcmtd.lib' that means that somewhere you are linking a release lib to a debug lib.

Klathzazt
A: 

If you give the finished exe to someone else they will need to install the latest visual c runtime to run it. This will only work for release build AFAIK. Visual studio should install the required runtime both release and debug into your path. The project probably has an additional dependency accidently set for an incorrect version of the runtime.

See if this page helps.

Tim Matthews
+3  A: 

if you delete the manifest file associated with you .exe, you will get the same error.

MSVCR90.dll is not installed in system32, but in the side-by-side folder, hence the manifest is required.

A: 

Go to your Project settings, Configuration Properties->C/C++->Code Generation and change Runtime Library from Multi-Threaded DLL to Multi-Threaded and then try to compile but it won't. Then change it to Multi-Threaded Debug and try to compile ,but it won't again and then you change it back to Multi-Threaded DLL and then it should compile and run.

A: 

I have just been bitten by this and this page got me working again.

graham.reeds