[英]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: 首先,一些误解:
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和其他)。
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.