title: VC 2010 Command line x64 picking up wrong libcmt.lib
body: <p>There has to be something I'm missing here. I've set up vcvars64.bat with the environment fine, and compilation and linking almost all of my libraries works great, except for libcmt.lib. (The /MT version of MSVCRT.lib.) This is included with the 32-bit VC 2010, but I'm using cl.exe and link.exe from the amd64 folder that was installed with the Platform SDK 7.1, so I have no idea why it's picking this up.</p>
  
  <p>Here's my command line:</p>
  
  <pre><code>link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\dev\Python31\libs /LIBPATH:C:\dev\Python31\PCbuild\amd64 ws2_32.lib advapi32.lib kernel32.lib /EXPORT:PyInit_winrandom build\temp.win-amd64-3.3\Release\src/winrand.obj /OUT:build\lib.win-amd64-3.3\Crypto\Random\OSRNG\winrandom.pyd /IMPLIB:build\temp.win-amd64-3.3\Release\src\winrandom.lib /MANIFESTFILE:build\temp.win-amd64-3.3\Release\src\winrandom.pyd.manifest /VERBOSE
  </code></pre>
  
  <p>What I've tried: <code>/nodefaultlib:libcmt</code> causes the linker to not even look at that library. <code>libcmt.lib /nodefaultlib:libcmt</code> in either order just reactivates the same behavior, it still looks in the old wrong path only, as seen in the verbose output:</p>
  
  <pre><code>Searching [SDK]\lib\x64\ws2_32.lib:
  Searching [SDK]\lib\x64\advapi32.lib:
  Searching [SDK]\lib\x64\kernel32.lib:
  Searching [VS]\VC\LIB\libcmt.lib:
  </code></pre>
  
  <p>My path doesn't have any lib folder on it, and %lib% is "[SDK]\lib\x64;[VS]\VC\LIB" (full paths ommitted).</p>
  
  <p>I don't know why this one lib is being searched on the wrong path first, does anyone know?</p>