设置通过Nuget安装的C ++库的链接类型 [英] Setting linkage type for C++ library installed via Nuget

查看:134
本文介绍了设置通过Nuget安装的C ++库的链接类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

答案提到了以下方法以链接到C ++库的静态​​版本[在这种情况下为"freeglut ]通过Nuget安装:

This answer mentions the following method to link to the static version of a C++ library [in this case, "freeglut"] installed via Nuget:

Project->Properties->Configuration Properties->Referenced Packages->freeglut->Linkage (select static) 

在Visual Studio 2015中,我找不到参考包".我拥有的唯一对Nuget软件包的明确引用是packages.config xml文件.如果转到项目的管理Nuget程序包"部分,则可以安装或卸载,但找不到该程序包的任何详细信息.

With Visual Studio 2015 I can't find "Referenced Packages". The only explicit reference to Nuget packages that I have is the packages.config xml file. If I go to the "Manage Nuget packages" section of the project I can install or un-install but I can't find any detail of the package.

我在msdn中搜索了文档,但是所有页面都专门用于创建程序包,而我需要尝试使用这种程序包的方法.有问题的程序包(Boost单元测试框架)可以用于带有静态链接或动态链接的仅标头,我想知道在哪里可以决定.

I have searched msdn for documentation but all the pages are devoted to the creation of a package, while I need to espress the way to consume such a package. The package in question (Boost Unit Test Framework) can be used header-only, with static or with dynamic linkage and I would like to know where I can decide it.

也许我正在变老,但是Nuget对我来说有点太神奇了...

Maybe I am getting old, but Nuget is a bit too magic for me...

更新

这就是我所看到的-您可以看到已经安装了Nuget软件包,特别是boost,但是在Configuration属性下没有指向参考软件包"的链接:

This is what I am seeing - you can see that there are Nuget packages installed, in particular boost, but that under the Configuration properties there is no link to "Referenced packages":

出于完整性考虑,VS 2015 Enterprise的版本为:

For completeness, the version of VS 2015 Enterprise is:

14.0.25431.01更新3

14.0.25431.01 Update 3

并且我已经检查了安装Boost测试软件包时,我同时获得了静态(.lib)和动态(.dll)链接版本,因为VS版本的文件位于packages文件夹中.

and I have checked that when I installed the Boost Test Package I got both the static (.lib) and dynamic (.dll) linkage versions, since the files for my VS version are present in the packages folder.

推荐答案

Boost正在使用自动链接.这意味着,Boost源代码根据构建环境和配置来决定使用哪个库(文件).

Boost is using auto-linking. It means, the Boost source code decides which library (file) to use depending on build environment and configuration.

更新,这是过程

  1. 您将仅Boost标头的NuGet包添加到您的项目.
  2. 根据您使用的内容和构建配置,Boost可能需要其他库(lib文件).在这种情况下,您将收到编译/链接错误.
  3. 根据编译/链接错误,您从
  1. You add the Boost headers only NuGet package to your project.
  2. Depending on what are you using and build configuration, Boost may require additional libraries (lib files). In this case, you will receive a compilation/linking error.
  3. Depending on the compilation/linking error, you add to your project additional NuGet packages with precompiled Boost libraries from here

我同意,这个过程并不明显.为了改进它,Boost应该首先完成其模块化.我的意思是,Boost库(标头和二进制文件)可以单独运送时.

I agree, the process is not obvious. To improve it, Boost should finalize their modularization first. I mean, when Boost libraries (headers and binaries) can be shipped separately.

这篇关于设置通过Nuget安装的C ++库的链接类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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