5

I installed MinGW by following their home page to their sourceforge and using mingw-get-setup.exe. This installed g++ 4.8.1-4. GCC 4.8 is supposed to support C++14 with a command-line switch, but I just get an "unrecognized option" error.

Is this a bug with MinGW? With GCC? What can I do about it? Since I know someone will ask, I want C++14 for its for-each loops. I'm using iterators for now, but for-each would improve both readability and writability.

EDIT: Found out my g++ build supports c++11, so I can use for-each. But still no luck on c++14 support.

8
  • I doubt that it is a bug... Commented Jul 24, 2015 at 1:31
  • 1
    What's a "C++14 for-each loop"?
    – Kerrek SB
    Commented Jul 24, 2015 at 1:33
  • Lets you iterate over vector<Thing> with for (Thing t : things) Commented Jul 24, 2015 at 1:42
  • 1
    If all you want is the new for-std=c++11 should get it done. Commented Jul 24, 2015 at 1:45
  • 1
    Try adding -D__GXX_EXPERIMENTAL_CXX0X__ as well. Smurfed if I know what's experimental about C++11 at this point, though. Commented Jul 24, 2015 at 1:50

1 Answer 1

8

g++ 4.8 simply does not support C++14, also MinGW is quite outdated when there are more new versions of gcc.

Alternatives you can use

If you want really to use C++11 or C++14 on windows with gcc you should be using one of the following options:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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