Simple C++ compiler for windows

At least some of the obvious candidates:

VC++: As of VC++ 2010 is starting to support some C++11 features. VC++11 (currently in beta testing) adds a few more. Has pretty decent code generation, a debugger quite a few people think is the best you can get, and an IDE that produces rather mixed reviews. Many who've used them consider older generations of the IDE (VC++5 and 6) better in at least some ways, but the compiler has improved so much since then that the older IDEs really aren't an option for most people (except to support ancient code).

MinGW: STL's current package features gcc 4.7.0, which (at least arguably) has somewhat better C++11 support than VC++. It includes quite a few ported Unix/Linux tools, but is basically a command line-only environment. If you want something like an IDE, you'll have to install/configure it separately.

Cygwin: This is also based on gcc, but instead of porting the compiler to Windows, they ported Linux to Windows, and run the compiler on the ported Linux. Obviously I'm exaggerating (a little) but not a whole lot -- Cygwin is mostly to run Linux/Unix code on Windows with as few alterations as possible. The tools they ship fit that as well -- it's doing its best to be a Unix-like environment that runs under the Windows kernel. It definitely would not be my first choice for any new development.

Qt Creator/SDK: this is another packaging of gcc, but with an IDE. If you want to write code using Qt it might well be your first choice. Otherwise, I'd probably avoid it -- while it probably can work fine otherwise, it's written assuming Qt as the default.

Eclipse/CDT: You can find this packaged with a copy of g++ as well. At least the last time I tried, it needed quite a bit of work on the configuration before I could even get it to compile correctly. If you use Eclipse for other purposes, getting it to do C++ is probably worthwhile. Otherwise, I'd personally avoid it.

C++ Builder: In the Borland days, this was the biggest challenger to Microsoft's dominance. Embarcadero seems to be trying to get it back in the mainstream again. The emphasis here seems to be much more on the IDE, GUI toolkit, etc., than the compiler proper. The compiler itself seems to be somewhat behind gcc and/or VC++. The starter edition costs $150, and limits sales of output to $1000, at which point you need to spend most of your $1000 on an upgrade to the Professional edition.

Clang: The most recently started of the major compilers, but really working at being one of the best. Has some of the best diagnostics of any compiler available. Targets LLVM, which gives it quite a variety of tools for run-time analysis and such. Its major corporate sponsor is Apple, though, so while it runs nicely out of the box on OS/X (and is now the default compiler there) on Windows, you're a lot more on your own -- AFAIK, you need some other compiler installed and working (and really know how to use it) to get this to install at all. On Windows, this a bit like buying a muscle car from a junk yard. With enough work, you may end up with the coolest car in town -- but on Windows it's currently more a project than a tool.

A few more to generally avoid:

  1. Any version of VC++ before about 2008. Simply inferior implementation of C++.
  2. Any version of g++ before 4.x. Again, inferior implementation of C++.
  3. djgpp: pretty much the worst of the worst. This really targets MS-DOS with a (custom) DOS extender. An ancient version of gcc rounds out the awfulness.
  4. OpenWatcom: also primarily targets MS-DOS. It uses a DOS extender that's better than djgpp's, but that's pretty much damning with faint praise. The compiler isn't really even very close to conforming with C++98; C++11 updates strike me as unlikely to come soon (if ever).
  5. Digital Mars: Walter Bright now works mostly on his own D language. Though a C++ compiler is still available, the C++ it compiles is fairly obsolete.

Summary: if you want an IDE, VC++ Express is the clear choice. If you care more about the latest C++11 features and don't mind working from the command line, MinGW is probably the top choice. The others definitely have niches, but I'd consider most of them inferior if your aim is primarily to new, write portable C++.


I'm currently using the MinGW distro by Stephan Lavavej at http://nuwen.net/mingw.html

I use it to produce .exe files using gcc.

You just have to be happy with the collection of tools he has included.


I know you're question mentions "allow me to pass around small exe's" but if you're interested (like me) in sometimes just running C++ code and not creating an exe, you might want to give Compile and Execute C++ Online a try.

Tags:

C++