GCC值得在Windows上使用以取代MSVC

GCC值得在Windows上使用以取代MSVC

本文介绍了GCC值得在Windows上使用以取代MSVC?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在Windows上使用Visual Studio 2010在C ++中开发。在官方公布C ++ 11之后,我已经开始使用MSVC中已经提供的一些功能。但是,如预期的,大部分的新的更改不受支持。



我想也许即将到来的Visual Studio版本将添加这些新功能。但是,在阅读后,它看起来很少会更改。



因此,我很好奇在Windows上使用GCC的可行性,而不是MSVC,因为它似乎支持绝大多数C ++ 11已经。据我所知,这意味着使用MinGW(我还没有看到任何其他本机Windows版本的GCC)。但我对这是否值得尝试有疑问:




  • 它可以用作cl.exe的替代它会涉及很多黑客和兼容性问题,以使Visual Studio使用不同的编译器?

  • 在我看来,Visual Studio的主要卖点是它的调试器。

  • 由于GCC来自* nix世界,并且不是Windows本机的,因此创建本机Windows应用程序时存在代码质量问题,与使用本地MSVC编译器?

  • 换句话说,我编译的exe的质量会受到使用非Windows本机编译器的影响吗?

MSVC有一个巨大的优势,即在Windows下没有平等的IDE,包括调试器支持。



对于MinGW来说,最好的替代方法是Code :: Blocks,但它们之间有世界,特别是关于代码完成和调试器。



此外,MSVC允许您使用MinGW不支持的一些专有的Microsoft东西(MFC,ATL和可能的其他),并使使用GDI +和DirectX更简单和更直接(虽然可能)。



在另一篇文章中提到的Cygwin会有额外的依赖和可能的许可证问题(依赖是GPL,所以你的程序也必须是)。 MinGW没有任何此类依赖或问题。



MinGW还会显着地编译 慢于MSVC(尽管预编译头有所帮助) p>

尽管如此,GCC / MinGW是一个完全可靠的质量编译器,在我看来,在生成代码的质量方面,它的性能优于任何迄今可用的MSVC版本。

这对于最新版本的MSVC来说有些不太明显,但仍然可见。特别是对于与SSE,内在函数和内联汇编有关的任何事情,GCC自从(自从慢慢追赶起)以来一直完全消灭MSVC。



更好的在GCC太,它可以是一把双刃剑(因为这可能意味着一些你的代码不会编译在更符合的编译器!),正如C ++ 11支持。



MinGW还支持DW2异常,它与正常风格完全不兼容,并在可执行文件中占用更多空间,但在积极的一面是在运行时几乎为零成本。 p>

I currently develop in C++ on Windows, using Visual Studio 2010. After the official announcement of C++11, I have begun to use some of its features that are already available in MSVC. But, as expected, the great majority of the new changes are not supported.

I thought maybe the upcoming version of Visual Studio would add these new features. However, after reading this it looks like very little is going to change.

And so, I'm curious about the feasibility of using GCC on Windows rather than MSVC, as it appears to support the great majority of C++11 already. As far as I can tell, this would mean using MinGW (I haven't seen any other native Windows versions of GCC). But I have questions about whether this would be worth trying:

  • Can it be used as a drop-in replacement for cl.exe, or would it involve a lot of hacks and compatibility issues to get Visual Studio to use a different compiler?
  • The main selling point for Visual Studio, in my opinion, is it's debugger. Is that still usable if you use a different compiler?
  • Since GCC comes from the *nix world, and isn't native to Windows, are there code quality issues with creating native Windows applications, versus using the native MSVC compiler? (If it matters: most of my projects are games.)
  • In other words, will the quality of my compiled exe's suffer from using a non-Windows-native compiler?

解决方案

MSVC has the huge advantage of coming with an IDE that has no equals under Windows, including debugger support.

The probably best alternative for MinGW would be Code::Blocks, but there are worlds in between, especially regarding code completion and the debugger.

Also, MSVC lets you use some proprietary Microsoft stuff (MFC, ATL, and possibly others) that MinGW has no support for, and makes using GDI+ and DirectX easier and more straightforward (though it is possible to do both with MinGW).

Cygwin, as mentioned in another post, will have extra dependencies and possible license issues (the dependency is GPL, so your programs must be, too). MinGW does not have any such dependency or issue.

MinGW also compiles significantly slower than MSVC (though precompiled headers help a little).

Despite all that, GCC/MinGW is an entirely reliable quality compiler, which in my opinion outperforms any to date available version of MSVC in terms of quality of generated code.
This is somewhat less pronounced with the most recent versions of MSVC, but still visible. Especially for anything related to SSE, intrinsics, and inline assembly, GCC has been totally anihilating MSVC ever since (though they're slowly catching up).

Standards compliance is a lot better in GCC too, which can be a double-edged sword (because it can mean that some of your code won't compile on the more conforming compiler!), as is C++11 support.

MinGW optionally also supports DW2 exceptions, which are totally incompatible with the "normal" flavour and take more space in the executable, but on the positive side are "practically zero cost" in runtime.

这篇关于GCC值得在Windows上使用以取代MSVC?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 22:13