Writing a C++ App



Here are some common questions we’ve had from users writing C++ applications using Cloud9:

Does Cloud9 support C++ 11?

Yes. As of writing we use GCC version 4.8.4 which supports all functionality of C++ 11. To use C++11 functions you will need to pass the flag -std=c++11 to the GCC compiler. You can add this to your runner with the following steps:

  • In the runner window click where it says “Runner: C++ (simple)”.
  • Click edit runner
  • Add this flag just after g++ on line 7. So the complete line should look like: "/usr/bin/g++ -std=c++11 $file -o runme; chmod 755 $file_path/runme; $file_path/runme"
  • Save the file in the default location as the filename it recommends.
  • Close the file and runner window (sometimes the runner doesn’t update if you don’t close it)
  • Re-run your file.

Does Cloud9 Support C++ 14?

Yes, gcc 5.x is available in the C++ workspace type, although we don’t support it by default at this time, you can edit the C++ runner or create a new runner.

The runner command should look something like:

"/usr/bin/g++-5 -std=c++14 $file -o runme; chmod 755 $file_path/runme; $file_path/runme"

Notice that it uses g+±5 instead of just g++ and has the flag -std=c++14 those are the only differences between it and the default c++ runner.

The ‘auto’ keyword is not working with Cloud9

When running your C++ application using the auto keyword you may see an error similar to: error: ‘x’ does not name a type

This is happening because the auto keyword is a C++11 feature. You’ll need to enable C++11 support in the runner. You can do this by following the steps under the “Does Cloud9 support C++ 11” FAQ heading above.


I am trying to edit the default C++ (simple) runner using the edit method described above.

I want to change it from generating an executable named main.cpp.o to something else, such as a.out for example. Students find it confusing when we are discussing our source code files (.cpp) which then get compiled into object files (.o) which then get linked into an executable file. When the executable is also named *.o, it’s unclear what this file is.

When I make that change, it saves to my .c9/runners folder. I have other runners in there and they display in my Run list. There are two problems though. If I just click Run, then it uses “Runner: Auto” and still makes the main.cpp.o file. If I manually select C++ (simple), it’ll either revert back to the Auto runner or use the original main.cpp.o runner.

Any tips on how to edit this default runner?


Does the debugger work with GCC 5 or GCC6? Are there official instructions for setting up GCC 6?