title: When Visual Studio generates 32bit .obj file and 64bit .obj file?
body: <p>I have 2 machines, both of which have the same copy of code. Both the machines are installed with the same Visual Studio, <strong>VS2013 ultimate version</strong>. </p>
  
  <p>The code is a QT project with lots of Windows APIs. So, <code>qmake</code> will generate <code>Makefile</code>, <code>Makefile.Debug</code> and <code>Makefile.Release</code>. These <code>Makefile</code> are the same on both machines. </p>
  
  <p>In <code>Makefile.Debug</code> and <code>Makefile.Release</code>, the actual compiler and linker are <code>VS's cl and link</code>. The difference between the 2 machines is, one is Windows 10, and the other is Windows 8.1. But both machines are 64-bit machine. </p>
  
  <p>The problem is, on Windows 10 machine, the build progress in QT Creator passes, but on Windows 8.1 machine, there will be one error while building.
  Firstly, the error was <strong><code>"xxx.dll: LNK1112: module machine type 'x64' conflicts with target machine type 'x86'"</code></strong>. I know here <code>"xxx.dll"</code> is indeed <code>'x64'</code> type, and I realized that the Windows 8.1 machine thinks the <code>"target machine type" is X86</code>, so I modified <code>Makefile.Debug</code> manually by adding <code>"/MACHINE:X64" to LINKFLAG</code>. This action changed the error to become <strong><code>"yyy.obj: module machine type 'x86' conflicts with target machine type 'x64'"</code></strong>. Yeah, this time the VS's link knows the target machine should be 'x64', but it looks like VS's compiler still compile some cpp file to be 32-bit .obj file. </p>
  
  <p><strong>My question is, why <code>VS's cl</code> thinks it should make a 32-bit obj file rather than a 64-bit obj file? And, how to let <code>VS's cl</code> make a 64-bit obj?</strong>  </p>
  
  <p>I checked the cl command on both machines. They are the same like below. </p>
  
  <pre><code>cl -c -nologo -Zc:wchar_t -FS -Zi -MDd -GR -W3 
  -w34100 -w34189 -w44996 -EHsc /Fd..\&lt;some folder&gt; 
  -DXXX -IYYY -Fodebug\ @C:\Users\someuser&gt;\AppData\Local\Temp\ZZZ.obj.8160.63.jom ZZZ.cpp
  </code></pre>