[英]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.