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.
Without changing anything from yesterday, the executable no longer links:
LINK : fatal error LNK1104: cannot open file 'mylib.lib'
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.
If I go into the executable project's settings and add a library directory for $(SolutionDir)\debug
, I instead get the following link error:
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'
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.
What would cause the linker not to find core libraries such as kernel32.lib, or for that matter, the output directory for my solution?
This is old-fashioned C++, a cross-platform library, not that managed stuff Microsoft added.