title: Linkage Error LNK1104 in Visual C++ 2010
body: <p>Today I fired up Visual Studio 2010 (Visual C++) and started working on a project. The solution contains two projects. One is a static library I am writing, the other is a test application containing unit tests for the library.</p>
  
  <p>Without changing anything from yesterday, the executable no longer links:</p>
  
  <pre><code>LINK : fatal error LNK1104: cannot open file 'mylib.lib'
  </code></pre>
  
  <p>The static library compiles and links fine. I have not changed the project settings in around a week, and it was linking just fine yesterday.</p>
  
  <p>If I go into the executable project's settings and add a library directory for <code>$(SolutionDir)\debug</code>, I instead get the following link error:</p>
  
  <pre><code>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
  </code></pre>
  
  <p>I am not sure what the problem is. I have tried cleaning, rebuilding, and even rebooting my machine. Google turned up some bugs in ancient Visual C++ versions (but I'm using 2010), as well as the possibility that the program is already running. However, it is not running, and a reboot confirms this.</p>
  
  <p>What would cause the linker not to find core libraries such as kernel32.lib, or for that matter, the output directory for my solution?</p>
  
  <p>This is old-fashioned C++, a cross-platform library, not that managed stuff Microsoft added.</p>