Windows C ++ compiler with full C ++ 11 support (should work with Qt)

Which C ++ compiler currently has full support for C ++ 11 on the Windows platform?

Currently, the Microsoft compiler does not have full C ++ 11 support (and it will not be added any time soon).
MinGW g ++ (from mingw.org) does not support std::thread out of the box. It also cannot compile Qt 4 sources (memory runs out when building QtGuid4.dll, known workarounds do not work for me).
I spent several days trying to get clang to work on windows, I was able to compile it, but could not turn on C ++ 11 support, because it required libstdC ++, which (I think) was not ported to the Windows platform on that moment. It is also not supported by Qt 4.

What else do you have? I have been working in C ++ 03 for a long time, and I would like to give a whirlwind to new functions, but I don’t need a tool with incomplete support (which will add an additional headache when writing code) or it may end up with a lack of memory (on an 8 GB system) when linking libraries.

I am working on Windows 7 64bit, and although support for the 64-bit version will be nice, I am mainly interested in 32-bit applications, so the ability to create 64-bit executables is optional.

Any suggestions?

+49
c ++ windows c ++ 11 qt
Oct 17 '13 at 11:28
source share
3 answers

First of all, see C ++ 11 Experimental Support Status in GCC 4.8 . Only one proposal has not yet been formally implemented. Then see C ++ 11 implementation status in libstdc++ . As you can see, some functions are not yet implemented. However, we can state that C ++ 11 support in GCC is more or less complete and convenient.

Now about Windows: perhaps definitely the best native (not Cygwin !) GCC port, which I personally consider to be manufacturing quality, MinGW-w64 . You can download it here . The current (at the time of writing) latest version is based on GCC 4.8.2. It already supports std::thread . What more, it offers all possible options:

  • 64-bit targets
  • 32-bit targets
  • Win32 streams
  • POSIX streams
  • SEH exceptions;
  • DWARF exceptions;
  • SJLJ exceptions.

Note:
Be careful when choosing a distribution to boot: for std::thread to be available, you need one that has POSIX threads.

In addition, I confirm that I myself have created Qt 4.8.4 and 4.8.5 several times and even aimed at this 64-bit toolchain. But that's not all, here is a list of some of the highlights that I personally created using MinGW-w64:

I think that I can create such huge and varied code bases as 64-bit targets with a good old GCC for Windows - this is a wonderful achievement of the MinGW-w64 development team. This once again proves the quality of the tool chain.

Qt 5




I recently built Qt 5.1.1 using the MinGW-w64 4.8.2 x64 targeting. In general, it went quite smoothly, but there are a few minor issues that need to be paid before assembly. I carefully collected all the necessary fixes and automated the whole process of fixing, building and installing with a simple script package. If you're interested, check out Qt for Windows . The use is so simple that I will skip commenting and just let you guys read the script package. Keep in mind that you need Unix patch.exe apply patches that you could get, for example, from MSYS or MSYS2 (see below). You can get the source code for Qt 5.1.1 here .

Note:
It does not seem reasonable to reinvent the wheel (by supporting personal build scripts and fixes for Qt). MSYS2 (see below) now takes care of everything . That is, if you need to rebuild Qt with various parameters and / or flags, simply edit the corresponding PKGBUILD file locally and use the makepkg-mingw utility accordingly.

Note:
In fact, the Qt project officially recommends using MinGW-w64 and MSYS2 .

About MSYS2




This was not set directly, but I would like to add it here, since it is the sister of the MinGW-w64 project, and it is very useful for anyone who needs to develop their own Windows software using an environment like Unix.

Those of you who have ever used the original MSYS probably know how old he is. It has not been improved for centuries, and all Unix utilities there are already terribly outdated.

The guys who provide the MinGW-w64 builds (listed above) now also provide the MSYS2 builds which you can download here . Recently, he left the beta version, so be sure to check out the latest version. It is built for both x86 and x64 architectures (with the MinGW-w64 instrumental grid itself). All utilities are updated to the latest versions. For example, you can already enjoy such things as: Bash 4.2, Make 3.99, Git 1.8.4 and many others; which run natively from Windows!

Note:
Be sure to check out their Wiki .

A brief history behind MinGW-w64




The original MinGW was very slow in improvements, and its developers did not even think of adding 64-bit support for generating target objects. One ambitious guy, Kai Tiz, took over and forked it, because his company needed to build 64-bit targets in Windows. This is how the MinGW-w64 project was born. Although the main goal was to add 64-bit support, developers in many aspects improved the tool chain and addressed many other problems. Since then, the MinGW-w64 project has grown and is now far superior to MinGW in quality. When MinGW-w64 invited MinGW to join the houses and work together, MinGW developers showed an inadequate reaction and refused to cooperate. As a result, today there are 2 projects with a similar name, which sometimes causes confusion, but the differences in quality and support speak for themselves.

+60
Oct 17 '13 at 11:51 on
source share

The main language is wise, Clang 3.3 and GCC 4.8.1 are fully compliant with C ++ 11 (regardless of whether they are bugs is another topic). The library (STL) is wise, Clang 3.3 (with lib ++, but you know, lib ++ is not yet used in both windows and linux) is the only platform that fully complies with C ++ 11.

MSVC, the latest, Visual C ++ 2013 (now RC, will be RTM in 2 days and will be available on November 13) provides much better support for C ++ 11 in both the base language and the STL, but not yet completed. STL wise, afayk, he is completed.

I think it depends on what function your codes really use. Have all the new features of C ++ 11 been used? If the Visual C ++ 2013 feature set can satisfy you, try it. Otherwise, clang has already provided a Windows port that can integrate into Visual Studio, and can reference an existing library (msvc C ++ runtime), I think you can also give it a trial version.

Supplement: Roadmap appropriate Visual C 11/14 ++ https://udta1g.blu.livefilestore.com/y2pMXBJL7l2a5UOf_pXnLXghSUhPWK8w5skFyc50SVFcMjVwa1guQnM6R0NNLN1buBUNPGbLBejpYXXBXSbqshQKKWVfQxvJjk2jGRPPbL-UBu7gaao4RxifZgPXY5ksdei/image1.png?psid=1

+8
Oct 17 '13 at 12:37 on
source share

Clang has full Windows support (by default, Windows library errors in lib ++) You can download the "official" assembly of clang 3.3 windows from here: http://www.llvm.org/builds/

It does not include libC ++, so you need to load either this or your standard library of your choice. I would recommend using libC ++ if possible, as this is currently the most complete implementation of the library, although I don't know how well it works on Windows.

0
Oct 17 '13 at 14:09
source share



All Articles