Compile C++11 code on Cloud9


#1

I’d like to compile basic c++11 examples on cloud9. But the default compiler doesn’t support those features.
Is there a way to change compiler settings to be able to get c++11 standard version on it?


#2

You should be able to compile your code with g++-4.8 by calling it with the --std=c++11 flag:

$ g++-4.8 --std=c++11 test.cpp
$ ./a.out
Hello, world

Here’s the test.cpp code I used, it contains a lamda:

#include <iostream>

using namespace std;

int main()
{
    auto func = [] () { cout << "Hello world"; };
    func(); // now call the function
}

#3

That’s right, but I’d like to do it via the green “run” button.
I thought there was a setting page somewhere to rewrite the IDE “compile and run” script.


#4

You can edit the runner to pass --std=c++11 flag to g++


#5

You can edit and customize your Runners, see https://docs.c9.io/docs/custom-runners