简体   繁体   English

MinGW作为可靠的64位GCC编译器

[英]MinGW as a reliable 64-bit GCC compiler

I am worried about the reliability of the MinGW compiler for 64-bit, as an alternative to the Visual C++ compiler. 我担心用于64位MinGW编译器作为Visual C ++编译器的替代方法的可靠性。

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? 例如,假设C ++代码在使用GCC 4.6.2的Linux下完美构建并运行,那么相应的MinGW是否会在64位Windows下生成类似可靠的可执行文件/库?

Is Cygwin a better option in terms of reliablity? 就可靠性而言,Cygwin是更好的选择吗? Is neither to the Visual C++ compiler? 两者都不是Visual C ++编译器吗?

First, some misconceptions: 首先,一些误解:

  1. MinGW(.org) does not provide a 64-bit version of its runtime. MinGW(.org)不提供其运行时的64位版本。 MinGW-w64 does, in addition to their 32-bit CRT. 除了其32位CRT外,MinGW-w64还支持。 They are also working on ARM support. 他们还致力于ARM支持。 And support various additional APIs (Win32 and others). 并支持各种其他API(Win32和其他)。

  2. Cygwin <-> MinGW-w64: Cygwin does not use the MS CRT (msvcrt.dll). Cygwin <-> MinGW-w64:Cygwin不使用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. 而是在Cygwin应用程序与系统的OS库(kernel32.dll,ntdll.dll等)之间插入POSIX兼容性层,即cygwin1.dll。

On to the question then... 接下来的问题...

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. 我发现MinGW-w64编译器非常好,并且GCC 4.6和更高版本(实际上是4.5.1和更高版本)能够为Windows生成良好的64位代码。 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. 请记住,MinGW提供了与msvcrt.dll基本上相同的C API,因此请访问msdn.com以获取文档(并确保查看文档的“ MSVC ++ 2003”版本,某些功能与较新的运行时有所不同),请勿认为因为是GCC,所以glibc文档突然适用于Windows。 Your code will have to be cross-platform. 您的代码必须是跨平台的。 Also note that sizeof(long)!=sizeof(T*) on x64 Windows. 另请注意,在x64 Windows上, sizeof(long)!=sizeof(T*) A commonly encountered error when porting *nix or x86 Windows code to x64 Windows. 将* nix或x86 Windows代码移植到x64 Windows时常见的错误。

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

相关问题 我可以从 32 位 GCC 编译器生成 64 位应用程序二进制文件吗? - Can I generate 64-Bit application binary from a 32-Bit GCC compiler? GCC 的 64 位版本未编译 64 位 exe - 64-bit version of GCC not compiling 64-bit exe “ void”编译器之前的预期主要表达式:TDM-GCC 4.6.1 64位 - Expected primary-expression before 'void' Compiler: TDM-GCC 4.6.1 64-bit 如何生成64位.dll哪个gcc编译器或其他。无法在AMD 64位平台上加载IA 32位.dll - How to generate 64 bit .dll which gcc compiler or other. Can't load IA 32-bit .dll on a AMD 64-bit platform 使用MinGW编译64位二进制文​​件(Dev-C ++) - Compile 64-bit binary with MinGW (Dev-C++) MinGW 64 c 编译器中缺少 bin.gcc? - bin.gcc missing in MinGW 64 c compiler? GCC:抱歉,未实现:64 位模式未编译 - GCC: sorry, unimplemented: 64-bit mode not compiled in 如何从32位进程中获取64位进程的可靠内存使用信息? - How to get a reliable memory usage information for a 64-bit process from a 32-bit process? 是否有带有C ++编译器且没有64位整数的平台? - Are there platforms with C++ compiler and without 64-bit integers? GCC无法对64位乘法进行矢量化。 可以在AVX2上对64位x 64位 - &gt; 128位加宽乘法进行矢量化吗? - GCC couldn't vectorize 64-bit multiplication. Can 64-bit x 64-bit -> 128-bit widening multiplication be vectorized on AVX2?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM