Making applications compiled in Visual Studio 2010 more compatible with more Windows Versions

I notice when I create an application and compile it with Visual Studio 2010, it only works on Vista+ computers (it also gives an error that MS is missing MSVCR100.dll) . I know this is probably due to the other computers not having .NET framework, but I was hoping there are some project settings I can alter which would reduce the dependency on .NET so it will run on a more diverse selection of Windows pcs.

Note: I'm not even compiling .NET applications, I'm compiling c++ applications, so I'm surprised to learn that even c++ compiled apps have the same dependencies as .NET apps.

Thanks for the time.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

evilrixSenior Software Engineer (Avast)Commented:
That's not the .Net framework, it is the C++ runtime and there is no way to break the dependency on this. The end user will need to install the appropriate redist runtime package. This can be distributed along with your application (it is included with Visual Studio) or it can be downloaded from Microsoft's website.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
The problem is - as you noticed - that the VS2010 runtime DLLs are missing, you will either need to install them. The package is available from ("Microsoft Visual C++ 2010 Redistributable Package (x86)"). Alternatively, you can link to the static versions of these libraries, which will omit installing the aforementioned runtime, yet the resulting binaries will be *way* bigger. In order to do that, open your project's properties (ALT+F7), go to "Configuration Properties|C/C++|Code Generation" and set "Use Runtime Library" from "Multithreaded (Debug) DLL" to "Multithreaded (Debug)" and rebuild.
You will find the same problem with all versions since VS2005: they all need the redist package.  It isn't good enough just to copy the libraries or to include them with the executable as with VS6 and VS2003.  This needs to be installed otherwise you might get "unable to run program" even though everything is there.

Also note that the redist package only contains the release version and that there are x86 and x64.
You can cofigure your project to link with everything statically as "jkr" mentioned above. I want to add only few things about ATL or MFC. If you want to use them, then you should change additionally:

"Configuration Properties / General / Use MFC" to value:
 - "Use MFC in a Static Library" or
 - "Use Standard Windows Libraries"

"Configuration Properties / General / Use of ATL" to value:
 - "Static Link to ATL"

But installing "VS Redistributables" is better idea.
Applications built with VS2010 C++ are officially compatible with Windows XP SP3 and later. Unofficially, they work with Windows XP SP2 and later.

If you want to support Windows 2000 and later, then see the comments for my blog posting:

If you only have a single EXE with no DLLs, then static linking is the way to go, as described above. However, if you have DLLs or multiple EXE files, then DLLs are the way to go. For additional information on how to redistribute the C run-time DLLs, see my additional blog posting on different ways to do this:

That particular post is about VS2008, but all of the techniques are the same. However, with VS2010, you do not have to worry about _BIND_TO_CURRENT_VCLIBS_VERSION.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.