Hello.I've been looking for a free C++ compiler for windows which supports the new standard features but i had little luck so far.Does someone have any knowledge of one? Thank you in advance.

Dani AI

Generated

Updated, practical summary and modern options (years after the original replies)

As and pointed out, GCC was the fastest to implement C++0x/C++11 back in 2011 and was right that MSVC2010 was incomplete. For readers arriving later: the situation has matured — GCC, Clang/LLVM and MSVC now implement most C++11 and later features, but the best tool depends on the workflow (Windows-native IDE, portability, libraries). For a feature-by-feature status and historical matrix, see the compiler support tables. (en.cppreference.com)

Recommended, practical route on Windows (easy, up-to-date GCC)
MSYS2 + mingw-w64 gives a native Windows package-managed way to install modern GCC (and Clang) toolchains. After installing MSYS2 follow the update steps and install a mingw-w64 toolchain; then verify with g++ --version. Example commands (run from the MSYS2 shell):

# update MSYS2 (may require closing and reopening the shell)
pacman -Syu

# install a 64-bit GCC toolchain
pacman -S mingw-w64-x86_64-toolchain

# alternative: install the UCRT-based GCC package
pacman -S mingw-w64-ucrt-x86_64-gcc

# verify
g++ --version

MSYS2 documents the installer and package names; mingw-w64 explains the runtime/library choices (winpthreads, UCRT vs MSVCRT). (msys2.org)

Cautions and when to pick MSVC or Clang
If the project targets Visual Studio, uses MSVC-only libraries or IDE integration, use MSVC (recent VS releases have greatly improved conformance). If portability and early-standard support matter, GCC or Clang are preferable. Avoid mixing object files from different toolchains (ABI and runtime differences). For compiler-specific feature status check MSVC and Clang conformance pages before using very new language/library features. This complements the original thread’s advice and gives a stable, modern path forward. (learn.microsoft.com)

Recommended Answers

All 9 Replies

I know the GNU g++ complier has limited support with the -std=gnu++0x switch.

There isn't a single compiler that supports all of C++0x at this point. I believe GCC (starting at 4.6 or 4.7) is the closest though, if you want to play with C++0x I'd go with GCC.

Thanks but i can't install Linux on that machine.How about Visual Studio Express 2008? I've never used Visual Studio before so i don't really know.

Thanks but i can't install Linux on that machine.

GCC isn't restricted to Linux. Try the nuwen build of MinGW if you're on Windows, it's up to GCC 4.6.1. If you're on OSX, macports offers a recent build of GCC as well.

How about Visual Studio Express 2008?

True C++0x support starts with 2010 (stuff like long long was supported as an extension before), but the is relatively short compared to GCC. Unfortunately, it doesn't seem like 2011 will be much better (still no variadic templates, for example).

Yes I think Visual studio 2010 has it

You don't need to install Linux. You can install code::blocks and then link it to a gcc compiler. Check this out.

Yes I think Visual studio 2010 has it

not really, MSVC 2010 has little support for c++ 0x
for example the syntax

for(int& x : <some vector/array/pointer>)

is not valid
same goes for 'constexpr' and many more..

for more vizit

Definitely GCC is the best (and only) compiler right now that has a pretty good support for C++0x (C++11) features. A quick look at reveals this pretty clearly. And specifically for GCC here. From looking at the list, you can see that 4.6 is a pretty good version, the things added by the absolute newest version (4.7) are not that important (and, of course, 4.7 is not released yet, but under development, so it can be hard to get it working on Windows). As suggested, you can use the nuwen build of MinGW for the state-of-the-art releases of GCC for windows. Using Cygwin is also an option I guess.

As for MSVC, don't even think about any version before 2010. Also note that, unlike GCC, MSVC enables C++0x features by default (in GCC you have to use the option -std=c++0x , or -std=gnu++0x for the GNU dialect). I wouldn't put too much hope in MSVC for standard compliance (considering the MSVC 2008 is the first decent version with respect to the C++98 standard), although is encouraging.

Another important consideration is the standard library support. On GCC, it is pretty close to complete (except for the things that rely on unsupported language features, and other the notable unsupported libraries are Regex and Future). As for MSVC10, I don't think they have done much more than promoting the TR1 libraries. However, good news! MSVC11 will feature an almost complete standard library support, although major language features will still be lacking. post takes a nice deep look into MSVC11 C++11 features. And on it is also very interesting.

In my opinion, the MSVC10 support for C++11 is not good enough to really do much playing around with C++11 features (except for rvalue-refs). On the other hand, GCC's support for C++11 features is pretty good, but a few important things are still missing, especially template aliases and delegating/inheriting constructors! But so far, it seems like C++11 feature support is moving forward pretty quickly, maybe we will even have essentially full support on the three major compilers (MSVC, GCC, and ICC) in little more than a year from now.

For production code, I would still suggest that you keep it to C++03, and if you want to use C++11 features, then condition their use against a compilation flag (like "ENABLE_CXX11_FEATURES").

You all have my full gratitude.I was actually hoping the GCC is available on Windows but i guess i didn't do enough research.Anyway thanks.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.