Use C++ 14 as default version



hello is anyone here can help me with this code it doesn’t work here online but on visual studio works correctly how can i make default to work ?


using std::cin;
using std::cout;
using std::endl;
using std::string;

int main()
    string str("Some string");
    for (auto c : str)
        cout << c << endl;

    return 0;


Cloud9 uses the gcc compiler which by default doesn’t work with C++ 11. This means the auto keyword won’t work. You can make it work by following the instructions here:


Yes, it will work because the code snippet above is C++ 11 code. But C++ 14 features are currently not supported, because this would require a gcc 5.x version. The actual gcc version used is 4.8.4


You can install gcc 5+ if you like with the following commands:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-5 

Then you can compile your files with g++-5 -std=c++14 <filename>. I just tested your file and it compiled successfully. I’ve added this information and how to modify the runner to our documentation page too:


So here is my runner for c++14 (below). I installed gcc 5+ as shown in your post and can compile correctly from the command line as also shown in your post. I tried to edit the c++ runner (below) and I get an error when running from the editor. The only c++14 code I tested was int x = 1’000’000; This generates a compiler error when using the runner below. (I probably understand less than half of the runner.)

Thanks for any help, Peter

// This file overrides the built-in C++ (simple) runner
// For more information see!/api/run-method-run
  "script": [
    "set -e",
    "if [ \"$debug\" == true ]; then ",
    "/usr/bin/g++5 -ggdb3 -std=c++14 $file -o $file.o",
    "chmod 755 \"$file.o\"",
    "node $HOME/.c9/bin/c9gdbshim.js \"$file.o\" $args",
    "/usr/bin/g++5 -std=c++14 $file -o $file.o",
    "chmod 755 $file.o",
    "$file.o $args",
  "info": "Running $file",
  "debugger": "gdb",
  "$debugDefaultState": false,
  "env": {},
  "selector": "^.*\\.(cpp|cc)$"


sounds like runner file didn’t get applied somewhy, try renaming it and choosing the new one from the dropdown.
also not that there is a typo in your code instead of /usr/bin/g++5 it should be g++-5


That worked, fixed the typo and saved with new name.

Thank you for the quick response! -Peter