Visual Studio:链接:致命错误 LNK1181:无法打开输入文件

一段时间以来,我一直在 Visual Studio 2010 中遇到一个奇怪的错误.

I've been encountering a strange bug in Visual Studio 2010 for some time now.

我有一个解决方案,其中包含一个编译为静态库的项目,以及另一个非常简单但依赖于该库的项目.

I have a solution consisting of a project which compiles to a static library, and another project which is really simple but depends on this library.

有时,最近几天非常频繁,在重建解决方案或仅使用 1-3 个更改的源文件编译后,我收到以下错误:

Sometimes, in the last days extremely frequent, after Rebuilding the Solution or just compiling it with 1-3 changed source files, I get the following error:

2>LINK : fatal error LNK1181: cannot open input file 'thelibrary.lib'
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========

编译 thelibrary.lib 是成功的,没有任何错误或警告.

Where compiling thelibrary.lib was a success without any errors or warnings.

我已尝试清洁解决方案,但这并不总是有效.

I have tried cleaning the solution, but that doesn't always work.

  • 这里有什么问题?

推荐答案

在 Linker, general, Additional library 目录中,将目录添加到您已包含在 Linker, Input 中的 .dll 或 .libs 中.如果你把它放在 VC++ 目录、库目录中,它就不起作用了.

In Linker, general, additional library directories, add the directory to the .dll or .libs you have included in Linker, Input. It does not work if you put this in VC++ Directories, Library Directories.

相关文章