C++ – How to build C++ app which runs on plain old XP SP2 with Visual Studio 2008 and no Side-by-Side DLLs

ccrtside-by-sidevisual-studio-2008

I'd like to compile a C++ project with just a single call to WinExec in order to launch another executable with some command line parameters. I've no idea what settings to specify in my project in order to get produce an executable that works without requiring Microsoft side-by-side DLLs, which I don't want to have to install on my target system. Any hints?

The symptom is an application which fails to start and the following event getting written to the application log (freely translated from French):

Error, SideBySide, event #33
Microsoft.VC90.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" cannot be found. 

UPDATE: I know that using WinExec is bad practice, but it works like a charm, and Microsoft can't possibly remove it in any future release of the API, can't they?

Best Answer

If you specify that you want to statically link the run-time (/MT or /MTd) you should be good. Project Properties->C/C++->Code Generation->Runtime Library