title: Clang C++ Cross Compiler - Generating Windows Executable from Mac OS X
body: <p>I have created a C++ application using Xcode on my Mac using the Clang compiler. </p>
  
  <p>I want to compile my source files to create an executable that can be ran on a windows machine however I cant get Clang to generate me an executable.</p>
  
  <p>Here is what I've tried:</p>
  
  <pre><code>clang++ -std=c++11 -stdlib=libc++ -arch x86_64 class1.cpp class2.cpp... -o executable.exe
  </code></pre>
  
  <p>This creates an executable however this does not run (Windows gives me an error to do with the application being 16 bit -dont understand this- that cant run on 64 bit)</p>
  
  <pre><code>clang++ -std=c++11 -stdlib=libc++ -target i386-pc-win32 class1.cpp class2.cpp 
  </code></pre>
  
  <p>For some reason whenever I use the <code>-target</code> flag I get an error stating that the compiler cannot find the <code>&lt;iostream&gt;</code> header however any other time it never moans.<br>
   I have tried using <code>-Ipath/to/iostreamfolder/</code> however this doesnt produce any better results</p>
  
  <p>Any suggestions would be great! Thanks!</p>
  
  <p>I have also tried the <code>'-triple x86-pc-win32'</code> flag however I get this warning <code>clang: warning: argument unused during compilation: '-triple x86-pc-win32'</code></p>