简体   繁体   English

我应该在 c++ 中将整个库添加到我的项目中吗

[英]Should I add whole library to my project in c++

I am pretty new to c++. At the moment I am working on ONNX involving project and I have a question, if I have to make my application portable (assuming that person which will be using it does not have installed onnx on their machine) do I have to install whole library in my project folder or how should I do it?我是 c++ 的新手。目前我正在研究涉及项目的 ONNX,我有一个问题,如果我必须使我的应用程序可移植(假设将使用它的人没有在他们的机器上安装 onnx)做我必须在我的项目文件夹中安装整个库,或者我应该怎么做?

Thanks for help感谢帮助

So one option is to link all your libraries statically, so the person using the application does not need to have a particular library installed on their machine因此,一种选择是静态链接所有库,这样使用该应用程序的人就不需要在他们的机器上安装特定的库

See this Q/A:看到这个问答:

Compiling a static executable with CMake 使用 CMake 编译 static 可执行文件

I recommend setting up a CI machine where these libraries are available (or better yet with a reproducible installation script/container configuration) ( yes this represents some work to set up for you) and then giving the statically linked binaries buit on this machine to your clients (so no hassle for them).我建议在这些库可用的地方设置一个 CI 机器(或者更好的是使用可重现的安装脚本/容器配置)(的,这代表了一些需要为你设置的工作),然后将这台机器上的静态链接二进制文件提供给你的客户(所以对他们来说没有麻烦)。

You'll read online about potential compatibility issues with statically linked binaries and complaints about exe size (some people believe -static is evil), but honestly this approach puts the least strain possible on client configuration.您将在网上阅读有关静态链接二进制文件的潜在兼容性问题和对 exe 大小的抱怨(有些人认为-static是邪恶的),但老实说,这种方法对客户端配置的压力可能最小。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将库添加到NetBeans C ++项目? - How do I add a library to my NetBeans C++ project? 在Visual Studio 2013中为我的C ++项目使用Boost库我应该怎么做 - what should I do to use boost library for my c++ project in VisualStudio 2013 如何在我的C ++ Android Gradle项目中添加“something.a”库文件? - How do I add a “something.a” library file to my C++ Android Gradle project? 如何在C ++项目中声明全局变量? - How should I declare global variables in my C++ project? 如何在我的C ++项目中包含activeX库? - How do I include an activeX library in my C++ project? 我不知道如何使用/运行这些位于我试图添加到项目中的 Github C++ 库中的文件? - I Don't Know How To Use/Run These Files That Are In A Github C++ Library I'm Trying To Add To My Project? 在 VSCode 和 OpenCV 中编辑 C++ 项目,无需安装整个库 - Edit C++ project in VSCode and OpenCV without installing the whole library 我应该将throw()添加到我的C ++析构函数的声明中吗? - Should I add throw() to the declarations for my C++ destructors? 将外部库添加到当前的c ++项目中 - Add external library into current c++ project 将库添加到Eclipse C ++项目(ROOT) - add library to eclipse C++ project (ROOT)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM