VS 2012不构建依赖项目 [英] VS 2012 Does Not Build Dependent Project

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

问题描述

我在Visual Studio 2012(版本11.0.50727.1)中有两个C ++项目。
项目B通过项目属性>公共属性>框架和引用取决于项目A.



B,项目A的lib不会在输出目录中生成,因此B失败。日志显示A正在成功创建,但是lib根本不显示。



真奇怪的部分是,当我做一个'clean然后build'而不是重建,一切正常工作。类似地,项目A自己构建良好并生成 .lib 。不幸的是,我必须使用的构建系统将进行重建,如果可能,我不想改变。



我试过的



我删除了框架引用,并尝试添加lib作为链接器依赖关系B.在这种情况下,A仍然无法构建,



我在SO和google上搜索了一段时间,但到目前为止已经变短了。



请告诉我您是否遇到类似的情况!

解决方案

A和B共享一个中间目录。



这是我的猜测,发生了什么:




  • 目录用于确定哪些文件需要清除输出dir,因此A.lib未正确删除
  • 未找到A.lib

  • 这在以前版本的VS中工作,因为我们没有以前启用的项目的并行构建,所以我假设所有项目首先被清理,然后建立。


    I have two C++ projects in Visual Studio 2012 (Version 11.0.50727.1). Project B depends on project A, via Project Properties > Common Properties > Framework and References.

    When I do a rebuild on B, the lib for project A doesn't get generated in the output directory, so B fails. The logs show that A is being built successfully, but the lib simply doesn't show up.

    The really strange part is that when I do a 'clean then build' instead of 'rebuild,' everything works correctly. Similarly, project A builds fine on its own and generates a .lib. Unfortunately, the build system I have to use will be doing a 'rebuild,' and I would rather not change that if possible.

    What I've Tried

    I removed the framework reference and tried to add the lib as a linker dependency in B. In this case, A still failed to build, so I ended up with a missing reference.

    I've searched on SO and google for a while, but have come up short so far.

    Please let me know if you've ever run into something similar!

    解决方案

    Looks like the problem was that A and B shared an intermediate directory. Making the two distinct seems to have fixed the issue.

    Here's my guess as to what's happening:

    1. A gets built correctly.
    2. B starts building by doing "clean"
    3. The contents of the intermediate directory are used to determine which files need to be cleaned out of output dir, so A.lib is incorrectly removed
    4. A.lib not found

    This worked in previous version of VS because we did not have parallel building of projects enabled before, so I'm assuming all projects were first cleaned, then built.

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

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