This project has moved and is read-only. For the latest updates, please go here.
1

Closed

Cannot compile project using Multi-threaded (/MT)

description

I have change the project settings to Multi-threaded (/MT) so that my project when configured to deploy in Release, the compiled game.exe, will be able to run on any Windows System with no C/C++ Runtime library installed.

I received many errors during compilation:
Error 47 error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MD_DynamicRelease' doesn't match value 'MT_StaticRelease' in AudioDXTK.obj

Image

Is there any solution to this? If not, how can I run games on Windows System that does not have any runtime libraries installed?
Closed Sep 15, 2016 at 7:57 AM by walbourn

comments

walbourn wrote Sep 15, 2016 at 7:56 AM

In general, static linking is not recommended for many reasons. The main reason it is supported for the compiler at all is for 'bootstrapper' things like writing an installer.

You don't need to use static library linking to achieve this. With VS 2012, VS 2013, and VS 2015 you are free to include the CRT DLLs side-by-side with your EXE, which is called 'application-local deployment'. See MSDN

If you must use static linking, then you need to create/modify the static library project settings and build DirectXTK to match your application.

As you are using DirectX Tool Kit for Audio, it is worth noting that XAudio is only built into the Windows 8.0 or later operating system. If you are supporting Windows Vista SP2 or Windows 7, then you must use legacy DirectSetup to deploy the XAudio DLL anyhow. In which case, there's no reason at all to use static linking as you can just chain the Visual C++ REDIST with the required installer.