简体   繁体   English

我应该为C ++ / CMake项目使用MinGW来最小化MS DLL的依赖性吗?

[英]Should i use MinGW for C++/CMake project to minimize dependencies of MS's DLLs?

When i use Visual Studio, my executables depends on microsoft redistributable package - the package that deploys MS's runtime DLLs. 当我使用Visual Studio时,我的可执行文件取决于Microsoft可再发行组件包-部署MS的运行时DLL的包。 That is annoying to me. 这让我很烦。 What disatwantages my executable would have if i would use MinGW? 如果我使用MinGW,我的可执行文件会有什么不利之处?

I also want to try link with lib- avcodec/avformat, that are built by MinGW and i have no my own mind power to build them in VS from src. 我还想尝试与由MinGW生成的libavcodec / avformat链接,我没有自己的能力来从src在VS中构建它们。

In case of using MinGW you will depend on DLLs that are shipped with mingw. 如果使用MinGW,则取决于mingw附带的DLL。 It is not big deal to change one vendor to another. 将一个供应商更改为另一个供应商并不重要。

If you already have MS project, review possibility to statically link MS libraries (it is option is provided for some of VisualStudio projects on creation time in project options) 如果您已经有MS项目,请检查是否有可能静态链接MS库(在项目选项中的创建时为某些Visual Studio项目提供了此选项)

You can link everything statically with MinGW. 您可以将所有内容与MinGW静态链接。 Use the -static linker flag. 使用-static链接器标志。

No need for redistributing any DLL's, but you have to make sure that in the c++, there's no exceptions being passed over DLL boundaries (so make sure every C++ library is linked statically in this case). 无需重新分发任何DLL,但必须确保在c ++中,没有异常通过DLL边界传递(因此,在这种情况下,请确保每个C ++库都是静态链接的)。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM