3
votes

I created simple Windows Runtime Component using Visual Studio template. By default project is dynamically linked to C/C++ Runtime Library with MD/MDd option.

When I change it into MT/MTd (Project properties -> C/C++ -> Code Generation -> Runtime Library) and build the project I am getting error

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1693,5): error MSB8024: Using static version of the C++ runtime library is not supported.

How can I compile Windows Runtime Component with MTd option? I need this since WinRT Component will refer other 3rd part library which is built with statically linked C++ runtime library.

1
The error message is quite explicit, there is no magic button you can push to make it disappear. Having to rebuild a library to match the compiler version and settings is entirely normal. If it is not yours then ask the owner for a rebuild. And keep in mind that such a library is unlikely to work at all in a UWP app, verifying it with WACK is essential. - Hans Passant
The solution is to request a version of the 3rd party library that dynamically links against the same CRT you are using in your component. - IInspectable

1 Answers

1
votes

Unfortunately you can't avoid the restriction.

But I have doubts about "I need this since WinRT Component will refer other 3rd part library which is built with statically linked C++ runtime library". Did you try to use that 3rd part library? You should have no problems adding it to your project.