gpt4 book ai didi

c++ - Visual Studio 2010 不会自动链接来自依赖项的项目中的静态库,因为它应该是

转载 作者:IT老高 更新时间:2023-10-28 11:08:07 27 4
gpt4 key购买 nike

  • 使用 C++ 控制台命令行项目创建新解决方案
  • 创建一个新项目,一个 C++ 静态库
  • 使命令行项目依赖于库
  • 确保在 Configuration => Linker => General 中打开“Link Library Dependencies”(默认情况下)
  • Visual Studio 仍不会链接库。

我该如何解决这个问题?它在 Visual Studio 2008 中工作。

最佳答案

这仍然有效,但是是 changed在 VS 2010 中:

"With VS2010, we stopped supporting project dependencies defining implicit references and we also introduced a new way of defining project dependencies at the project level. Since a project reference and a project dependency are close concepts, both applying to a project, it made sense to have them represented together, in a consistent way, in the project file. As you will see in the snippets below, the only difference between a project reference definition and a project dependency definition consists in metadata that defines the output assembly inclusion/exclusion into/from the main project link command line. Although we did not remove the “Project Dependencies” dialog, we recommend defining new project dependencies via the “Framework and References” dialog. You need to set the “Reference Assembly Output” property in the property page UI to false for a project dependency and to true for a project reference."

在控制台项目上右键,选择“属性->通用属性->框架和引用->添加新引用”,添加静态库项目;还要检查右侧的“链接库依赖项”是否为真。似乎适用于调试和发布版本。你每天学习新的东西。 ;)

关于c++ - Visual Studio 2010 不会自动链接来自依赖项的项目中的静态库,因为它应该是,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3795567/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com