windows 是否可以在没有 Cygwin 或 MinGW 的情况下使用 GCC?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1120467/
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
Is it possible to use GCC without Cygwin or MinGW?
提问by Frank V
GCCis a very well respected multi-language compiler (from what I've gathered). One thing I've not been able to definitively find out is: Is it possible to use GCC on windows withoutanything extra like Cygwinor MinGW?
GCC是一个非常受人尊敬的多语言编译器(从我收集到的)。我无法确定地发现的一件事是:是否可以在 Windows 上使用 GCC而没有像Cygwin或MinGW这样的额外东西?
I've learned that if you use GCCon Cygwin, there is a dependency on a DLL. If you use GCC with MinGW, you eliminate that dependency but you still must have MinGW to use GCC.
我了解到,如果您在 Cygwin 上使用GCC,则会依赖于 DLL。如果您将 GCC 与 MinGW 一起使用,则消除了这种依赖关系,但您仍然必须拥有 MinGW 才能使用 GCC。
Is it possible to build GCC and utilize it by itself, completely native to Windows? Like Microsoft's Compiler? After reading around, my guessis no. But I'd still like more info, if possible.
是否可以构建 GCC 并单独使用它,完全是 Windows 原生的?像微软的编译器?仔细阅读后,我的猜测是否定的。但如果可能的话,我仍然想要更多信息。
If not, why does GCC require environments like Cygwin or MinGW?I understand this now. It is because GCC requires a Unix/POSIX environment. Whyit does, it still beyond me.
如果不是,为什么 GCC 需要 Cygwin 或 MinGW 之类的环境?我现在明白了。这是因为 GCC 需要 Unix/POSIX 环境。为什么会这样,它仍然超出我的范围。
I did find this and it helps but doesn't reallyanswer my question: Why does GCC-Windows depend on cygwin?
我确实找到了这个,它有帮助,但并没有真正回答我的问题:为什么 GCC-Windows 依赖于 cygwin?
To refine my question, I guess what I'm tryingto understand why GCC can't stand on it's own -- Where I have just "GCC.exe".
为了完善我的问题,我想我想了解为什么 GCC 不能独立存在——我只有“GCC.exe”。
采纳答案by Frank V
For MinGW, you need MinGW in the sense that MinGW provides the implementation of the gcc language system. I don't see how your question makes sense - it's like "Can I use VC++ without installing VC++?"
对于 MinGW,您需要 MinGW,因为 MinGW 提供了 gcc 语言系统的实现。我不明白你的问题有什么意义——就像“我可以在不安装 VC++ 的情况下使用 VC++ 吗?”
To clarify:MinGW is the GCC compiler executable(s), headers and support objects. There isn't anything else. There is a related but independant package called MSYS which provides some posix utilities, but you do not need this in any way in order to use the MinGW version of GCC.
澄清一下:MinGW 是 GCC 编译器可执行文件、头文件和支持对象。没有别的了。有一个称为 MSYS 的相关但独立的包,它提供了一些 posix 实用程序,但您不需要以任何方式使用 GCC 的 MinGW 版本。
回答by OneOfOne
To disable mingw's extra dependency simply don't use exceptions (-fno-exceptions), I haven't used cygwin so not sure.
要禁用 mingw 的额外依赖,请不要使用异常(-fno-exceptions),我没有使用过 cygwin,所以不确定。
回答by MHesham
Linaro used to provide that long time ago, a GCC that runs naively on Windows without MinGW or Cygwin. I am currently using that GCC 4.9 on a Windows 10 PC to compile UEFI and it is working like charm.
很久以前,Linaro 曾经提供过一个 GCC,它可以在没有 MinGW 或 Cygwin 的情况下在 Windows 上天真地运行。我目前正在 Windows 10 PC 上使用 GCC 4.9 来编译 UEFI,它的工作原理非常棒。
回答by Marco van de Voort
What is exactly the problem with mingw? And what is native?
mingw 到底有什么问题?什么是原生的?
mingw used to generate pretty much standalone binaries, and maybe that is even more native than MSVC's, which require msvcrt, a component that needs to be installed sometimes.
mingw 过去常常生成几乎独立的二进制文件,也许这比 MSVC 更原生,后者需要 msvcrt,有时需要安装一个组件。
So maybe you could explain what you tried with mingw, and what the exact problem is.
所以也许你可以解释你用 mingw 尝试了什么,以及确切的问题是什么。
回答by Alexander Trauzzi
I don't think so. I've had to compile some command line apps for people in the past and always had to use cygwin.
我不这么认为。过去我不得不为人们编译一些命令行应用程序,并且总是不得不使用 cygwin。
I think the biggest reason being posix compatibility, which is what cygwin strives to bring to Win32.
我认为最大的原因是posix兼容性,这是cygwin努力为Win32带来的。