Dev-C 's default compilation mode, C 98, does not support modern C features like range-based for loops. To utilize these features, you must switch the compiler to a mode that supports C 0x.
Locate the "Tools" menu in Dev-C and select "Compiler Options". In the pop-up window, navigate to the "Compiler" tab.
Enable the checkbox labeled "Add the following commands when calling the compiler". In the text entry field below, enter either "-std=c 11" or "-std=C 0x".
The error message "[Error] range-based-for loops are not allowed in C 98 mode" indicates that the compiler is still running in C 98 mode. Ensure that you have followed the steps above and restarted the IDE if necessary.
After making these changes, Dev-C should compile your code with support for range-based for loops and other C 0x features.
The above is the detailed content of How to Enable C 11/C 0x Support in Dev-C for Range-Based For Loops?. For more information, please follow other related articles on the PHP Chinese website!