分发使用MinGW g ++编译的程序 [英] Distribute a program compiled with MinGW g++

查看:102
本文介绍了分发使用MinGW g ++编译的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我使用MinGW 64(g ++编译器)创建并编译了一个简单程序。在我的计算机上运行该程序,并在Process Explorer中查找该程序正在使用的DLL文件(在很多其他程序中):

Let's say I have created and compiled a simple program using the MinGW 64 (g++ compiler). Running this program on my computer and looking in Process Explorer for what DLL files the program is using I find (among many others):

libgcc_s_seh-1.dll
libstdc++6.dll
libwinpthread-1.dll

这是我的MinGW安装文件夹下唯一的那些文件。其余的DLL文件位于 C:\Windows 下。

These are the only ones that reside under my MinGW installation folder. The rest of the DLL files used reside under C:\Windows.

问题1:

MinGW DLL文件是否是MinGW C ++运行时库(可以这么说)?它们是否具有与msvcrXXX.dll(XXX = Microsoft运行时库的版本)相同的目的。

Are the MinGW DLL files the MinGW C++ runtime libraries (so to speak)? Do they serve the same purpose as for example msvcrXXX.dll (XXX = version of Microsoft runtime library).

问题2:

如果我想在未安装MinGW的另一台计算机上运行该应用程序,是否包括上面列出的那些DLL文件就足够了(即,将它们放置在与我的文件夹相同的文件夹中可执行文件)以使其在另一台计算机上运行(我们假设另一台计算机也是64位Windows计算机)。如果是,这是否意味着我们基本上将MinGW C ++运行时附带了可执行文件。如果没有,为什么?

If I want to run the application on a different computer which does not have MinGW installed, is it sufficient to include those DLL files listed above (i.e. placing them in the same folder as my executable) to have it run on the other computer (we assume the other computer is also a 64-bit Windows machine). If yes, does this mean we basically ship the MinGW C++ runtime with our executable. If no, why?

推荐答案

libstdc ++ 6.dll 是C ++标准库,例如你说。

libstdc++6.dll is the C++ standard library, like you said.

libwinpthread-1.dll 用于C ++ 11线程支持。 MinGW-W64有两种可能的线程变体:要么使用Windows的本机函数(例如CreateThread),要么像std :: thread这样的C ++ 11东西将不可用。或包含此库并使用C ++ 11类(也是)。

请注意,要切换线程模型,您需要重新安装MinGW。仅删除DLL而不使用C ++ 11的东西是行不通的,尽管如此,在当前安装中仍将需要DLL。

libwinpthread-1.dll is for C++11 threading support. MinGW-W64 has two possible thread variants: Either use the native Windows functions like CreateThread, but C++11 stuff like std::thread won´t be available then; or include this library and use the C++11 classes (too).
Note that to switch the thread model, you´ll need to reinstall MinGW. Just removing the DLL and not using the C++11 stuff won´t work, the DLL will be required nonetheless with your current install.

libgcc_s_seh-1 .dll 与C ++异常处理有关。

libgcc_s_seh-1.dll is something about C++ exception handling.

是的,也应该提供DLL也足够了(

(或使用静态链接并仅提供程序文件)。

Yes, it should be sufficient to deliver the DLLs too
(or use static linking and deliver only your program file).

这篇关于分发使用MinGW g ++编译的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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