This error, as correctly identified above, is due to the compiler not using c++11 or above standard. This answer is for Windows 10.
For c++11 and above standard support in codeblocks version 17:
Click settings in the toolbar.
A drop-down menu appears. Select compiler option.
Choose Global Compiler Settings.
In the toolbar in this new window in second section, choose compiler settings.
Then choose compiler flags option in below toolbar.
Unfold general tab. Check the C++ standard that you want your compiler to follow.
Click OK.
For those who are trying to get C++11 support in Sublime text.
Download mingw compiler version 7 or above. In versions below this, the default c++ standard used is c++98 whereas in versions higher than 7, the default standard used is c++11.
Copy the folder in main C drive. It should not be inside any other folder in C drive.
Rename the folder as MinGW. This name is case insensitive, so it should any variation of mingw and must not include any other characters in the name.
Then go to environment variables and edit the path variable. Add this "C:\mingw\bin" and click OK.
You can check the version of g++ in cmd by typing g++ -v
.
This should be sufficient to enable c++11 in sublime text.
If you want to take inputs and outputs as well from input files for competitive programming purposes, then follow this link.