Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

I need some opinion. GCC was always a very good compiler, but recently it is losing "appeal". I have just found that on Windows GCC does not have std::thread support, forcing Windows users to use another compiler because the most exciting feature is still missing.

But why really doesn't GCC still have threads support under Windows? License problems? ABI incompatibilities? (Well there are already several cross-platform libraries using multithreading: boost, POCO, SDL, wxwidgets, etc. Wouldn't it be simple to use already existing, and MIT/libpng licensed, code to fit this hole instead of shipping GCC releases with no thread support?)

Recently, looking at compiler comparisons, GCC has the widest support for C++11 features with respect to other compilers, except for the fact that on Windows this is not true because we are still lacking atomics, mutexes and threads :/

I'd like to know more about this topic, but the only thing I can find is people asking for help because:

"thread" does not exist in std namespace

Looking at tickets tracking and mail discussions of GCC/TDM-GCC, there were requests for thread support since 2009. Possible that after 4 years still no solution? What's really happening?

share|improve this question

closed as primarily opinion-based by Snowman, gnat, MichaelT, durron597, Bart van Ingen Schenau Jun 16 at 13:56

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

gcc is still good, no matter what you recently found out. –  ott-- Apr 21 '13 at 21:41
I just liked std::thread . that was not such hard feature to implement. Just take variadics templates and for example SDL thread and you can make a class equivalent to std::thread :/ –  DarioOO Apr 21 '13 at 21:57
I would almost argue given the inability of average programmers to write reliable multi-threaded apps, no thread support is a bonus..... –  mattnz Apr 21 '13 at 22:44
you are complaining about libaries not specifically the compiler. –  wirrbel Apr 22 '13 at 8:55
GCC is popular, that is true. But I wouldn't say, that it's been "always a very good compiler". Ages ago people were experimenting with ICC on Linux, because of slow and bloated binaries which GCC produced. OTOH, all major open source project use VS to compile Windows version of their code, again, because GCC produces slow bloat in comparison. –  vartec Apr 22 '13 at 15:42

3 Answers 3

up vote 22 down vote accepted

I understood that GCC is falling out of favour because the people maintaining it have become somewhat arrogant, and now that LLVM is here (and is very good) people are voting with the feet.

Slashdot had a discussion about LLVM's new support for C++11. _merlin says:

Oh I don't think anyone thinks it's evil, just that it's pure self-interest rather than generosity. GCC's phenomenal popularity has led to its maintainers growing massive egos and behaving like total [****]. Bugs are introduced faster than Red Hat and Apple can get patches for them accepted, and they have a nasty habit of not looking at bug reports, then closing them due to inactivity without actually fixing them

which chimes in with your observation about the 4-year delay.

share|improve this answer
You might also find… (also by _merlin) to point out other problems with compiling for non-linux with gcc. –  MichaelT Apr 21 '13 at 23:34
It's not just LLVM, Visual Studio Express Editions are another viable, gratis alternative (considering the question is specifically about std::thread on Windows which is supported in VS2012 EE) –  MSalters Apr 22 '13 at 9:21
too bad VS2012 doesnt have full support for std::thread (e.g. no thread_local variables) –  alrikai Jul 5 '13 at 23:52

GCC's popularity and usability is not questionable.

From mingw build at supports threads.

But important consideration is License.

FreeBSD has an uneasy relationship with the GPL. BSD-license advocates believe that truly free software has no usage restrictions. GPL advocates believe that restrictions are necessary in order to protect software freedom, and specifically that the ability to create non-free software from free software is an unjust form of power rather than a freedom. The FreeBSD project, where possible, tries to avoid the use of the GPL (For details

Other important Considerations


  • The Clang ASTs and design are intended to be easily understandable by anyone who is familiar with the languages involved and who has a basic understanding of how a compiler works. GCC has a very old codebase which presents a steep learning curve to new developers.
  • Clang is designed as an API from its inception, allowing it to be reused by source analysis tools, refactoring, IDEs (etc) as well as for code generation. GCC is built as a monolithic static compiler, which makes it extremely difficult to use as an API and integrate into other tools. Further, its historic design and current policy makes it difficult to decouple the front-end from the rest of the compiler.
  • Various GCC design decisions make it very difficult to reuse: its build system is difficult to modify, you can't link multiple targets into one binary, you can't link multiple front-ends into one binary, it uses a custom garbage collector, uses global variables extensively, is not reentrant or multi-threadable, etc. Clang has none of these problems.
  • For every token, clang tracks information about where it was written and where it was ultimately expanded into if it was involved in a macro. GCC does not track information about macro instantiations when parsing source code. This makes it very difficult for source rewriting tools (e.g. for refactoring) to work in the presence of (even simple) macros.
  • Clang does not implicitly simplify code as it parses it like GCC does. Doing so causes many problems for source analysis tools: as one simple example, if you write "x-x" in your source code, the GCC AST will contain "0", with no mention of 'x'. This is extremely bad for a refactoring tool that wants to rename 'x'.
  • Clang can serialize its AST out to disk and read it back into another program, which is useful for whole program analysis. GCC does not have this. GCC's PCH mechanism (which is just a dump of the compiler memory image) is related, but is architecturally only able to read the dump back into the exact same executable as the one that produced it (it is not a structured format).
  • Clang is much faster and uses far less memory than GCC.
  • Clang aims to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. GCC's warnings are sometimes acceptable, but are often confusing and it does not support expressive diagnostics. Clang also preserves typedefs in diagnostics consistently, showing macro expansions and many other features.
  • Clang inherits a number of features from its use of LLVM as a backend, including support for a bytecode representation for intermediate code, pluggable optimizers, link-time optimization support, Just-In-Time compilation, ability to link in multiple code generators, etc.
  • Clang's support for C++ is more compliant than GCC's in many ways (e.g. conformant two phase name lookup).


  • The advantage of llvm/clang is its modular design, so it can be
    interfaced and used for example to create static code analysis tools, what becomes more and more important ()


  • clang is now ready to build software for production (either for C, C++ or Objective-C). This compiler is providing many more warnings and interesting errors than the gcc suite while not carrying the same legacy as gcc.
share|improve this answer
Best answer ever! –  Vorac Apr 29 '13 at 10:05
Just to be up-to-date: GCC tracks macros expansion since 4.8, with the option -ftrack-macro-expansion, now enabled by default :) –  Morwenn May 27 '13 at 8:02

The reason why it takes a lot of time is because it takes a lot of work to get a solid foundation to build the headers on top of. The way mingw-w64 seems to bo is to build a solid pthreads-like library on Windows. There's less upstream grumpiness over that than introducing a dependency on the native threading of the Windows API.

mingw-w64 implements <thread> and the other C++11 headers on top of their own winpthreads library. This should be available for testing in both Mingw-builds and rubenvb's distributions of the mingw-w64 toolchain. I would recommend following the mingw-w64 mailing lists if you want to track where most of the work on native Windows GCC work is done.

The Qt Project has a wiki page detailing their current recommendation and an over view of GCC toolchains on windows, see this Qt Project wiki page.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.