title: How do I compile for windows XP under windows 7 / visual studio 2008
body: <p>I'm running Windows 7 and Visual Studio 2008 Pro and trying to get my application to work on Windows XP SP3.</p>
  
  <p>It's a really minimal command line program so should have any ridiculous dependencies:</p>
  
  <pre><code>// XPBuild.cpp : Defines the entry point for the console application.
  //
  
  #include "stdafx.h"
  
  
  int _tmain(int argc, _TCHAR* argv[])
  {
      printf("Hello world");
      getchar();
      return 0;
  }
  </code></pre>
  
  <p>I read somewhere that <a href="http://msdn.microsoft.com/en-us/library/aa383745.aspx#3" rel="nofollow noreferrer">defining several constants such as WINVER</a> should allow me to compile for other platforms. I've tried the added the following to my <code>/D</code> compiler options:</p>
  
  <pre><code>;WINVER=0x0501;_WIN32_WINNT 0x0501;NTDDI_VERSION=NTDDI_WINXP
  </code></pre>
  
  <p>But that made no difference. When I run it on my Windows XP machine (actually running in a <a href="http://www.virtualbox.org/" rel="nofollow noreferrer">virtualbox</a>) I get the following error:</p>
  
  <blockquote>
    <p>This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.</p>
  </blockquote>
  
  <p>So what have I missed? Is there something else required to run MSVC compiled programs or a different compiler option or something else?</p>