eclipse MinGW 还是 Cygwin GCC?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13503533/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 19:28:06  来源:igfitidea点击:

MinGW or Cygwin GCC?

eclipsegcccygwinmingw

提问by tonga

I want to install a GCC compiler in Windows for the Eclipse IDE. I know there are two options: MinGW GCC or Cygwin GCC. Which one is better for Eclipse CDT? Any experience or suggestions will be appreciated.

我想在 Windows 中为 Eclipse IDE 安装 GCC 编译器。我知道有两种选择:MinGW GCC 或 Cygwin GCC。哪个更适合 Eclipse CDT?任何经验或建议将不胜感激。

回答by wardd

Using Cygwin means your program will be dependent on cygwin1.dll, which is essentially a layer that allows POSIX functionality to be used in a Windows environment. Compiling with the standard MinGW GCC provides no such dependancy. This means however, if you intend to compile with MinGW GCC, you will not have access to POSIX functions such as fork()and exec().

使用 Cygwin 意味着您的程序将依赖于cygwin1.dll,它本质上是一个允许在 Windows 环境中使用 POSIX 功能的层。使用标准 MinGW GCC 进行编译不提供这种依赖性。然而,这意味着,如果您打算使用 MinGW GCC 进行编译,您将无法访问 POSIX 函数,例如fork()exec()

For more information on the differences between Cygwin and MinGW, see here.

有关 Cygwin 和 MinGW 之间差异的更多信息,请参见此处

回答by earl3s

Personally I like Cygwin better, it has a lot of installation options and it feels a lot like the terminal you'll find on a Linux machine. It provides a pretty substantial set of Linux-like capabilities, something that Windows fails at miserably.

我个人更喜欢 Cygwin,它有很多安装选项,感觉很像您在 Linux 机器上找到的终端。它提供了一组相当丰富的类似 Linux 的功能,而 Windows 却在这方面惨遭失败。

回答by PersianGulf

Wikipedia Says:

维基百科说:

MinGWforked from version 1.3.3 of Cygwin. Although both Cygwinand MinGWcan be used to port UNIXsoftware to Windows, they have different approaches: Cygwinaims to provide a complete POSIX layerthat provides emulations of several system calls and libraries that exist on Linux, UNIX, and the BSDvariants. The POSIX layerruns on top of Windows, sacrificing performance where necessary for compatibility. Accordingly, this approach requires Windowsprograms written with Cygwinto run on top of a copylefted compatibility library that must be distributed with the program, along with the program's source code. MinGWaims to provide native functionality and performance via direct Windows API calls. Unlike Cygwin, MinGWdoes not require a compatibility layer DLLand thus programs do not need to be distributed with source code.

MinGW从 1.3.3 版分叉出来Cygwin。虽然两者CygwinMinGW可以用于端口UNIX的软件Windows,它们有不同的方法:Cygwin旨在提供一个完整的POSIX layer,它提供的几个系统调用,并且存在于库仿真LinuxUNIXBSD变种。在POSIX layer之上运行Windows,牺牲性能在必要的兼容性。因此,这种方法要求Windows编写的程序Cygwin运行在必须与程序一起分发的 Copyleft 兼容库之上,以及程序的source code. MinGW旨在通过直接提供本机功能和性能Windows API calls。不像CygwinMinGW不需要兼容层DLL,因此程序不需要与source code.

Because MinGWis dependent upon Windows API calls, it cannot provide a full POSIX API; it is unable to compile some UNIX applicationsthat can be compiled with Cygwin. Specifically, this applies to applications that require POSIXfunctionality like fork(), mmap()or ioctl()and those that expect to be run in a POSIX environment. Applications written using a cross-platform librarythat has itself been ported to MinGW, such as SDL, wxWidgets, Qt, or GTK+, will usually compile as easily in MinGWas they would in Cygwin.

因为MinGW是依赖Windows API calls,所以不能提供完整的POSIX API;它无法编译一些UNIX applications可以用Cygwin. 具体而言,这适用于需要的应用程序POSIX一样的功能fork()mmap()ioctl()和那些希望在运行POSIX environment。使用cross-platform library本身已被移植到的a 编写的应用程序MinGW,例如SDL, wxWidgets, Qt, or GTK+,通常会像在 中MinGW一样容易编译Cygwin

The combination of MinGWand MSYSprovides a small, self-contained environment that can be loaded onto removable media without leaving entries in the registry or files on the computer. CygwinPortable provides a similar feature. By providing more functionality, Cygwinbecomes more complicated to install and maintain.

的组合MinGW,并MSYS提供了一个可以装载到可移动媒体不留在计算机上的注册表项或文件小,独立的环境。Cygwin便携式提供了类似的功能。通过提供更多功能,Cygwin安装和维护变得更加复杂。

It is also possible to cross-compile Windows applicationswith MinGW-GCC under POSIX systems. This means that developers do not need a Windows installation with MSYSto compile software that will run on Windowswithout Cygwin.

也可以cross-compile Windows applicationsMinGW-GCC under POSIX systems. 这意味着开发人员无需安装 WindowsMSYS即可编译Windows无需Cygwin.

回答by chill

Cygwin and Mingw are not interchangeable alternatives. Cygwin is used to compile POSIX API programs, Mingw is used compile Windows API programs.

Cygwin 和 Mingw 不是可互换的替代品。Cygwin 用于编译 POSIX API 程序,Mingw 用于编译 Windows API 程序。

Chose one or the other depending on what kind program you're going to write.

根据您要编写的程序类型选择其中一种。

回答by Gibbon1

My offhand thoughts are, if you need cygwin, you need it. For instance compiling programs that were developed for Unix and have symbolic links and shell scripts in the build system.

我的想法是,如果你需要 cygwin,你就需要它。例如,编译为 Unix 开发并在构建系统中具有符号链接和 shell 脚本的程序。

If you don't need it, you don't want it. And compiling under linux on a virtual machine is often a better choice than going the cygwin route.

如果你不需要它,你就不想要它。在虚拟机上在 linux 下编译通常比走 cygwin 路线更好。

So mingw is perfectly fine. Works fine, simple to use.

所以mingw完全没问题。工作正常,使用简单。

Also: You might consider codelite (www.codelite.org) instead of Eclipse.

另外:您可能会考虑使用 codelite (www.codelite.org) 而不是 Eclipse。