Enabling C 11 in Qt Creator: A Step-by-Step Guide
Qt Creator 2.7.0 is reported to support C 11, but it may require some configurations to enable it. If you encounter errors like "range based for loops are not allowed in c 98 mode," despite trying to compile C 11 code, follow these instructions to enable C 11 support:
For Qt 4.8 and GCC/Clang:
QMAKE_CXXFLAGS += -std=c++11
(or QMAKE_CXXFLAGS = -std=c 0x)
For Qt 5:
CONFIG += c++11
Save your changes and rebuild your project. This should resolve the errors and allow you to compile and run C 11 code in Qt Creator.
The above is the detailed content of How to Enable C 11 Support in Qt Creator for Compiling C 11 Code?. For more information, please follow other related articles on the PHP Chinese website!