We have already published about Cling which has similar features to Clang REPL, but Clang REPL is an alternative already available for those who already have Clang/LLVM installed on their own system. If you don’t have it installed yet, see the links below:
Clang-Repl is an interactive C++ interpreter that allows incremental compilation.
Clang-Repl is suitable for exploratory programming and in places where time to gain insights is important. Clang-Repl is a project inspired by the work of Cling, a C/C++ interpreter based on LLVM.
To start Clang REPL, just type this command in the terminal:
A sub-shell will automatically start where you can run the commands, but first you need to include the desired library. For example, to use std::cout
we need to include the iostream
library:
And then, just test it by printing something:
To exit clang-repl
just press %quit
:
In other words, simple and intuitive! > Remember that clang-repl
does not interpret [Backspace] and does not use the readline lib to store commands in the history.
For more information, visit: https://clang.llvm.org/docs/ClangRepl.html.