C++11 range-based for loop doesn't seem to be working?
C++ Gurus
6
Posts
4
Posters
4.6k
Views
1
Watching
-
In "this":http://labs.qt.nokia.com/2011/05/26/cpp0x-in-qt/ blog post it says:
bq. you can write
@for (const QString &option : optionList) { ... }@However Qt Creator complains about unexpected : and the code actually fails to compile, I've tested with the bundled gcc4.4 as well as with 4.6. I have put the c++11 enable flag in the .pro file...
Any ideas?
-
-
-
C++11 support of GCC 4.4 is "mediocre":http://gcc.gnu.org/gcc-4.4/cxx0x_status.html - at best. For example there is no support for range-based for loops. You will have to update to a more recent version of GCC, like 4.6 or 4.7.
In addition, you will need a recent version of Qt - 4.8 at least.