Saiyan_1991's blog

By Saiyan_1991, history, 4 years ago, In English

I use minGW c++17 compiler in codeblocks. Recently I wanted to code in sublime text 3 and CP editor and there I'm continuously getting error message like "range-based 'for' loops only available with -std=c++11 or -std=gnu++11" , "'clamp' was not declared in this scope", "'nullptr' was not declared in this scope" etc. But in codeblocks those codes are fine and running smoothly. Even OJs are not giving compilation error.

Especially this blog's code snippets are are not working in my codeblocks compiler too!! But they are working fine in Codeforces custom invocation.

I have installed latest version of minGW compiler but still this problem is occurring. I tried to change (settings > compiler > toolchain executables) the path of the codeblocks inbuilt compiler with recent downloaded compiler but it is not compiling then.

so how can I,

  1. Change compiler in codeblocks.

  2. Merge c++11 and c++14 with c++17 like codeblocks so that i don't get above mentioned errors while I'm compiling in CP editor or sublime text.

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

You nee to use the compilation flag -std=c++17 for using c++17 features. there should be an option to put compilation flags in codeblocks settings somewhere.