Is there's a way to statically link vs 2010 runtime dlls?

Started by
5 comments, last by iMalc 11 years, 1 month ago

I was wondering if there was a way do statically link those 2 dlls you need for a vs 2010 application to work on someone's else machine if they don't have the runtime installed. That would make my life a bit easier, thx.

Advertisement

In the project properties, go to Configuration Properties, C++ and Code Generation, and change the Runtime Library option to a non-DLL runtime.

Thx ill give it a try

You may also need to set "Configuration Properties -> General -> Use of MFC" to "Use MFC in a Static Library".
Note that this doesn't only apply when you are actually using MFC yourself. It quite often applies when something you're using uses MFC itself internally I believe.
Sometimes you even need to do the same for the ATL setting right below that, IIRC.

If in doubt, Use the program "Depends.exe" before and after making these changes, to see what DLLs your program actually requires, and prove that you've removed the unwanted dependencies.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms

Thx for the tip but, I will never,never,never,never,never,never,never,never,never,never use mfc

NEVER !!

"Never" is a very long time.

Despite that, the point iMalc was making was that you may not be using MFC, but some other library that you're linking to may be using it behind your back, although I believe that the static vs dynamic usage of MFC would in that case depend on the project settings used for building that other library, not for your program.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

I once found it out in desparation, and have confirmed it several times since, that setting it to "Use MFC in a Static Library", removes some dependencies on other DLLs, and no I never use MFC either. If you still have unwanted dependencies, it cant hurt to try it out.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms

This topic is closed to new replies.

Advertisement