4 ms·
I just keep a fixed .cpp file with a bunch of common includes and directives, and alias the g++ command to link to common libraries, so my workflow goes: > vim
by fferen 14y ago
I just keep a fixed .cpp file with a bunch of common includes and directives, and alias the g++ command to link to common libraries, so my workflow goes:
> vim temp.cpp
> g++ temp.cpp
> ./a.out
Very similar to my process with Python, actually. Every time I use the REPL for some experimenting, the code ends up outgrowing it and I have to stuff it in a file anyway, so I may as well cut out the middleman to begin with. YMMV.
- sanxiyn 14y agoI too put the code in a file even in Python, but REPL is still valuable. I use "python -i" which runs your code (defines functions, classes, etc.) and then stop, and put you in that environment. This is very useful. It seems Cling could be used the same way: .x command.
- voltagex_ 14y agoI must be reading the wrong Python tutorials. Thank you for this
- rcfox 14y agoIf you don't need any special compiler flags, it's even simpler: make temp ./temp