阅读一个简单地工程代码,其中一个工程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. SymmetricDS 3.5.0 发布,数据同步和复制

    SymmetricDS 3.5.0 关闭 53 个问题,新增对 SQLite on Android.Sybase ASE 和 Sybase ASA 的支持:增加了文件同步功能,可同步目录.文件过滤和脚 ...

  2. MongoDB安装及shell简介

    MongoDB安装 MongoDB具有跨平台的优良特性,提供了对主流的操作系统支持,我们可以根据自己使用的操作系统,选择下载对应的安装包. 图 1. MongoDB支持各个版本的操作系统 MongoD ...

  3. Flash矢量图与位图性能对比

    Flash中使用位图的性能要高于矢量图,究竟有多大区别呢?数据有最好的说服力,开始测试: 一.机器配置 二.测试过程 测试程序控制红色小球在舞台中不停匀速移动,通过改变小球数量控制实际帧率在24帧/秒 ...

  4. [ACM_水题] Yet Another Story of Rock-paper-scissors [超水 剪刀石头布]

    Description Akihisa and Hideyoshi were lovers. They were sentenced to death by the FFF Inquisition. ...

  5. JSLint JavaScript代码质量审查工具汉化中文版隆重发布

    JSLint是一款JavaScript代码质量审查工具,它可以指出代码中错误.不规范的地方,非常之严格,甚至多写一个空格都会发出警告. JSLint的审查规则,根据众多前辈多年编程经验而写,字字珠玑, ...

  6. java包装类的作用

    转载自http://zhidao.baidu.com/question/2052192149152534987.html 第一,基本数据类型之间的相互转换不是都可以制动转换的,而你强制转换又会出问题, ...

  7. 近期code review几处小问题集锦

    1 线程池使用不当 我们的调度系统需要将一堆会员分配给相应的人员来处理,流程如以下伪代码所示: public void dispatch() { while (true) { List<Memb ...

  8. atitit.编辑表单的实现最佳实践dwr jq easyui

    atitit.编辑表单的实现最佳实践dwr jq easyui 1. 提交表单 1 2. 表单验证 1 3. 数据保存使用meger方式取代save&update方式 1 3.1. Filte ...

  9. CSS实现特殊效果

    CSS实现三道杠效果 http://jsbin.com/hocopusuvi/edit?html,css,output CSS实现圆点效果 http://jsbin.com/nojiromaje/ed ...

  10. Java null String

    In Java, the String will have different usage. Example: public class Test { public static void main( ...