none
How to convert /MD mode to /MT mode? Why is /ZW dependent on /MD mode? Alternative for “dll missing error”

    Question

  • Please help me on this below query. 
    I am stuck on this for so long. So I've been working on this metro apps(windows store apps) and wrote a code to fetch the details of the metro apps installed in the system. On a deep analysis, came to a conclusion of using packagemanager class provided by microsoft. This class is available under the header file But, collection.h needs /ZW(Consume Windows Runtime Extension) mode to be set in the visual studio project. This inturn needs a /MD(Multi -threaded DLL) compile mode.

    After building this project I tested the executable in some machines and these machines showed "DLL missing"error. These were the list of dlls missing vccorlib110.dll msvcp110.dll msvcr110.dll On further analysis I came to know these were dlls from Visual studio 2012 Redistributable.

    Now, I have the following queries
    1. Does the visual studio Redistributable gets installed in the latest OS(Windows 8 and above) by default. Because, some machines had these dlls(even though they din't have Visual studio installed) 
    2. If these dlls were to be pre-installed with the os and even then I am getting this "dll missing" error, does this mean the system is corrupted?
    3. Can I rewrite the code in such a way that I can use /MT mode instead of /MD method for using the WinRT libraries necessary for metro apps? In short, how to convert from /MD mode to /MT mode when I have these dependencies.

    Please guide me on my mistakes. Apologies if I am asking some obvious doubts.

    Monday, September 26, 2016 7:47 PM

Answers

  • I'll take a shot at this.

    Re: #1.   Answer:  No.  If some machines have those dlls but do not have Visual Studio installed, it's because they have the Microsoft Visual C++ 2012 Redistributable package installed.  You need to redistribute this with your software if you build with the DLL runtimes.  You can also get it here.

    Let me segue into #2, now.   The dll's are not included with the OS.  But just about any software you install that was written with Visual C++ will install them.  So that's probably why they are there.  You must also make sure you have the right version (2012, 2013, etc. ==> 110, 120, etc.)) and the right platform (x86 vs x64).  You will often find that ALL end up getting installed at some point.  See Why Are There So Many “Microsoft Visual C++ Redistributables” Installed on My PC?

    Note: you are NOT allowed to redistribute debug versions of the runtime.  So make sure you build your software in Release configuration.

    For #3, I admit that I don't know much about WinRT.  Sorry.  But basically if you have source for the module you can rebuild it to target whichever runtime you want.  But if you are linking against a pre-built binary, then you'll need a different binary that targets the runtime you DO want, or you'll need to switch runtimes to match the binary you ARE linking against.


    Tuesday, September 27, 2016 12:54 AM