VS2010 LNK1181与依赖重建项目时, [英] VS2010 LNK1181 when rebuilding project with dependency

查看:135
本文介绍了VS2010 LNK1181与依赖重建项目时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个C ++(CLR)项目的解决方案。其中一个项目引用其他的,所以项目依赖和构建顺序正确地反映这一点。这两个项目都指向同一个输出文件夹。依赖项目有配置的依赖复制本地:假

I have a solution with two C++ (CLR) projects. One project references the other, so the Project Dependencies and Build Order correctly reflect that. Both projects target the same output folder. The dependent project has the dependency configured with Copy Local: false.

如果我本身重建的依赖,它建立精细和它的目标是在输出目录。

If I "Rebuild" the dependency by itself, it builds fine and its targets are in the output directory.

当我重建的溶液(或依赖项目),我得到:

When I "Rebuild" the solution (or the dependent project), I get:

error LNK1181: cannot open input file '<outdir>\Dependency.lib'

果然,依赖输出从输出目录中消失了。如果我看生成日志,依赖似乎有(重新)正确构建,但这些产出似乎为因项目开工建设已经立即删除。为什么会发生呢?

Sure enough, the dependency outputs are gone from the output directory. If I look at the build log, the dependency seemed to have (re)built correctly, but then those outputs seem to have been deleted as soon as the dependent project build started. Why would that happen?

此外,当我清洁的解决方案,然后立即生成的解决方案,我没有得到任何错误。

Additionally, when I "Clean" the solution, then immediately "Build" the solution, I don't get any errors.

不是重建应该是,有效,清洁+建设?

Isn't "Rebuild" supposed to be, effectively, Clean + Build?

推荐答案

一个重建在Visual Studio清理并生成项目一个接一个,有什么可能最终发生的是

A rebuild in Visual Studio cleans and builds the projects one by one, so what probably ends up happening is


  • 项目A清洗。

  • 项目A编译。

  • 项目B清洗,由于相同的输出目录中删除从项目A的输出部分。

  • 项目B失败建筑物因缺少依赖。

更多讨论<一个href=\"http://stackoverflow.com/questions/1247457/difference-between-rebuild-and-clean-build-in-visual-studio-2008\">here.

这篇关于VS2010 LNK1181与依赖重建项目时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆