Various websites provide online access to C++ compilers. Online compiler’s feature set vary significantly from site to site, but usually they allow to do the following:
- Paste your code into a web form in the browser.
- Select some compiler options and compile the code.
- Collect compiler and/or program output.
Online compiler website behavior is usually quite restrictive as they allow anyone to run compilers and execute arbitrary code on their server side, whereas ordinarily remote arbitrary code execution is considered as vulnerability.
Online compilers may be useful for the following purposes:
- Run a small code snippet from a machine which lacks C++ compiler (smartphones, tablets, etc.).
- Ensure that code compiles successfully with different compilers and runs the same way regardless the compiler it was compiled with.
- Learn or teach basics of C++.
- Learn modern C++ features (C++14 and C++17 in near future) when up-to-date C++ compiler is not available on local machine.
- Spot a bug in your compiler by comparison with a large set of other compilers. Check if a compiler bug was fixed in future versions, which are unavailable on your machine.
- Solve online judge problems.
What online compilers should not be used for:
- Develop full-featured (even small) applications using C++. Usually online compilers do not allow to link with third-party libraries or download build artifacts.
- Perform intensive computations. Sever-side computing resources are limited, so any user-provided program will be killed after a few seconds of execution. The permitted execution time is usually enough for testing and learning.
- Attack compiler server itself or any third-party hosts on the net.
Examples:
Disclaimer: documentation author(s) are not affiliated with any resources listed below. Websites are listed alphabetically.
- http://codepad.org/ Online compiler with code sharing. Editing code after compiling with a source code warning or error does not work so well.
- http://coliru.stacked-crooked.com/ Online compiler for which you specify the command line. Provides both GCC and Clang compilers for use.