Changing Dev-C Mode to Support C 0x
Users learning range-based for loops in Dev-C may encounter the error "range-based-for loops are not allowed in C 98 mode." This indicates that the default mode in Dev-C is C 98, which does not support this feature and other aspects of C 0x.
To rectify this issue and enable support for C 0x features:
1. Access Compiler Options:
Navigate to "Tools -> Compiler Options" and select the "Compiler" tab.
2. Enable Custom Compiler Commands:
Check the checkbox labeled "Add the following commands when calling the compiler."
3. Specify C 0x Standard:
In the text entry box, enter either "-std=c 11" or "-std=C 0x" to specify the desired C 0x standard.
For example, if using Dev C version 5.3.0.3 with TDM-GCC 4.6.1 64 bit, the settings should appear as follows:
Compiler Options Panel:
These changes will alter the compiler behavior to support C 0x features, including range-based for loops.
The above is the detailed content of How to Enable C 0x Support in Dev-C ?. For more information, please follow other related articles on the PHP Chinese website!