阅读一个简单地工程代码,其中一个工程BaseCode是 static lib,另一个工程RunBaseCode使用该lib,但在工程设置的“Linker\Input\AdditionalDependencies” 中并没有添加对该lib的引用,而在“Linker\Command Line”中却发现BaseCode.lib已经添加进来了,这是怎么回事呢?

首先怀疑是Solution中设置的 “Project Dependencies”编译依赖,隐含的添加了lib,因此想把RunBaseCode对BaseCode的依赖去掉试试看。取消依赖时,却发现取消不了,出现"The dependency was added by the project system and cannot be removed" 错误。那这个编译依赖是在哪里添加的呢?

原来是在“Project References”中设置的。

右键\Properties\Common Properties\Framework and References\Add New Reference。

设置Reference后,该工程就自动加上了“Project Dependencies”。

那默认添加对BaseCode.lib的引用,是否是由于设置了“Project Dependencies”呢?不是的,是由于上面所述的设置“Reference”导致的。验证的情况如下:

1. 点击“Remove Reference”去掉工程关联后,默认的“Project Dependencies”也取消掉了。这时,手动添加“Project Dependencies”,发现“Linker\Command Line”中没有自动添加BaseCode.lib。

2. 将上一步骤中的“Project Dependencies”去掉,然后“右键\Properties\Common Properties\Framework and References\Add New Reference”,这时“Linker\Command Line”中自动添加了BaseCode.lib。

References

【1】Error while removing project dependency in VS2010 (http://stackoverflow.com/questions/12818315/error-while-removing-project-dependency-in-vs2010)

【2】VS项目依赖(http://www.cppblog.com/mythma/archive/2011/08/05/this_dependency_was_added_by_the_project_system_and_cannot_be_removed.html

关于"The dependency was added by the project system and cannot be removed" Error的更多相关文章

  1. Android Studio添加应用作为依赖时报错Error:Dependency MonthText:xlistview:unspecified on project app resolves to an APK archive which is not supported as a compilation dependency. File: 及其解决方案

    Error:Dependency MonthText:xlistview:unspecified on project app resolves to an APK archive which is ...

  2. [转]A reference to a higher version or incompatible assembly cannot be added to the project

    If you face this error message while adding a reference to your project in Visual Studio try the fol ...

  3. [转帖]SAP一句话入门:Project System

    SAP一句话入门:Project System http://blog.vsharing.com/MilesForce/A621279.html 这是SAP ERP入门的最后一篇了. 我们这些死跑龙套 ...

  4. Fix: Compile project encounter undefined reference to“xxx”error

    Need to add all the new cpp files to jni/Andriod.mk folder:

  5. How to: Modify a Project System So That Projects Load in Multiple Versions of Visual Studio

    http://msdn.microsoft.com/en-us/library/hh266706(v=VS.110).aspx

  6. Adding a custom jar as a maven dependency

    Using maven in a Java project is great. It manages builds (as customized as you may need), execution ...

  7. 软件工程 week 02

    一.地址链接 1.作业地址:https://edu.cnblogs.com/campus/nenu/2016CS/homework/2110 2.git仓库地址:https://git.coding. ...

  8. [asp.net core]project.json(1)

    摘要 前面介绍了使用vs2015新建asp.net core web的内容,这篇文章学习下project.json文件的内容. project.json 原文:https://docs.microso ...

  9. maven 三个基本插件 clean dependency compiler

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

随机推荐

  1. elixir 高可用系列(二) GenServer

    概述 如果我们需要管理多个进程,那么,就需要一个专门的 server 来集中监控和控制这些进程的状态,启停等. OTP 平台中的 GenServer 就是对这个 server 通用部分的抽象. 利用 ...

  2. 个性二维码开源专题<后背景>

    //设置图片资源 private Image img1; public override void SetParam() { base.SetParam(); //读取图片 string _image ...

  3. 史无前例的Firefox奇怪问题:host中的common名称造成css文件无法加载

    今天遭遇了一个非常非常奇怪的问题,一个css文件(common.cnblogs.com/Skins/marvin3/green.css),Firefox怎么也无法打开,一直在转圈. 而换成其它浏览器都 ...

  4. 从代码分析Android-Universal-Image-Loader的图片加载、显示流程

    从UNIVERSAL IMAGE LOADER. PART 3(四个DisplayImage重载方法详解)中,我们学习了Android-Universal-Image-Loader(以下简称UIL)中 ...

  5. [游戏模版11] Win32 动画 时间消息

    >_<:This time we will study a new way to operate your picture.That is running your picture by ...

  6. git查看一个文件的历史记录

    git log --all -- '*'FILENAME'*' 支持模糊查询 主要用于查找历史上被删除的文件 可以做成git的一个快捷命令 find = "!f(){ git log --a ...

  7. Proxy模式:管理第三方API

    软件中的Barrier. 数据从程序移到DB中时,要跨越数据库的Barrier.消息从一个PC到另一个PC时,要跨越网络Barrier. 跨越可能是复杂的,很可能处理Barrier的Code会多于处理 ...

  8. ESXi5 中克隆Linux虚拟主机的网络配置

    虚拟化技术果然非常方便,尤其是windows主机,克隆后在网络管理中改一下IP即可. 但对于Linux来说就有点麻烦,只修改IP还不行,还有MAC地址,网卡指定等,这个规程对应新手来说没有大半天搞不定 ...

  9. Leetcode 9 Palindrome Number 数论

    判断一个数是否是回文数 方法是将数回转,看回转的数和原数是否相同 class Solution { public: bool isPalindrome(int x) { ) return false; ...

  10. Log4cpp介绍及使用

    Log4cpp是一个开源的C++类库,它提供了在C++程序中使用日志和跟踪调试的功能.使用log4cpp,可以很便利地将日志或者跟踪调试信息写入字符流.内存字符串队列.文件.回滚文件.调试器.Wind ...