MinGW作为一个可靠的64位GCC编译器 [英] MinGW as a reliable 64-bit GCC compiler

查看:560
本文介绍了MinGW作为一个可靠的64位GCC编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我担心64位的MinGW编译器的可靠性,作为Visual C ++编译器的替代。

I am worried about the reliability of the MinGW compiler for 64-bit, as an alternative to the Visual C++ compiler.

例如,假设C ++代码构建和在Linux下使用GCC 4.6.2完全运行,相应的MinGW将在64位Windows下生成类似可靠的可执行文件/库吗?

For example, assuming C++ code builds and runs perfectly under Linux using GCC 4.6.2, will the corresponding MinGW produce similarly reliable executables/libraries under 64-bit Windows?

Cygwin在可靠性方面是一个更好的选择?是不是对Visual C ++编译器?

Is Cygwin a better option in terms of reliablity? Is neither to the Visual C++ compiler?

推荐答案

首先,一些误解:


  1. MinGW(.org)不提供其运行时的64位版本。 MinGW-w64除了它们的32位CRT。他们还在ARM支持工作。

  1. MinGW(.org) does not provide a 64-bit version of its runtime. MinGW-w64 does, in addition to their 32-bit CRT. They are also working on ARM support. And support various additional APIs (Win32 and others).

Cygwin < - > MinGW-w64:Cygwin没有使用MS CRT(msvcrt.dll) 。它改为在您的Cygwin应用程序和系统的操作系统库(kernel32.dll,ntdll.dll等)之间插入一个POSIX兼容层,即cygwin1.dll。

Cygwin <-> MinGW-w64: Cygwin does not use the MS CRT (msvcrt.dll). It instead inserts a POSIX compatibility layer in between your Cygwin app and the system's OS libraries (kernel32.dll, ntdll.dll, etc.), namely cygwin1.dll.

在问题上...

我发现MinGW-w64编译器非常好,GCC 4.6及以上(实际上,4.5.1及以上)非常有能力为Windows生成良好的64位代码。请记住,MinGW提供与msvcrt.dll基本相同的C API,所以转到msdn.com文档(并确保查看MSVC ++ 2003版本的文档,一些功能与较新的运行时有所不同),不要认为因为它是GCC,glibc文档突然适用于Windows。您的代码必须跨平台。还要注意x64 Windows上的 sizeof(long)!= sizeof(T *)将* nix或x86 Windows代码移植到x64 Windows时常出现错误。

I have found the MinGW-w64 compilers very good, and GCC 4.6 and above (actually, 4.5.1 and above) are very capable of producing good 64-bit code for Windows. Please remember that MinGW provides essentially the same C API as msvcrt.dll, so go to msdn.com for documentation (and be sure to look at the "MSVC++ 2003" version of documentation, some functions differ with the newer runtimes), do not think that because it's GCC, glibc documentation suddenly applies to Windows. Your code will have to be cross-platform. Also note that sizeof(long)!=sizeof(T*) on x64 Windows. A commonly encountered error when porting *nix or x86 Windows code to x64 Windows.

这篇关于MinGW作为一个可靠的64位GCC编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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