A simpler shorter way to Compile & Run
a .cpp file
Very useful 'command line tool' specially for learners, doing many throwaway project or stuff
Instead of -> and many a times, like or worse than
So what this utility does is ->
- 1st case -
# Instead of
g++ try.cpp && ./a.out
#use
run try.cpp
- 2nd case -
# Instead of
g++ try.cpp --std=c++20 -o try && ./try
# use
run try.cpp 20
- 3rd case -
# Instead of
g++ try.cpp --std=c++20 -o try && ./try adi
# use
run try.cpp 20 -- adi
The important plus point is, you can use auto-completetion for file names, so many a times you just need to just type run a<tab>
g++ run.cpp -o run
Then add the run
file to your /usr/bin (or add current path to PATH)
On Windows -> Add the folder to your PATH
This is the command format ->
run <filename> <compiler_args> <cpp_version> -- <program_args>
Only the
filename
is mandatory
<filename>
-> File name, for eg. 'try.cpp'<compiler_args>
-> Like-g -o try
etc. [Defaults - '']<cpp_version>
-> Just a number, eg. 17 20 will be understood as --std=c++17 and --std=c++20 repectively [Default - 17]<program_args>
-> As per your program's needs
I may not be working on this for now, i have what i wanted ( this was not meant to spend an hour initially anyways :D )
Add "run --help" support too, maybe use an arg parser
run dbg try.cpp
-> Adds '-g' compiler flag, and executesgdb
on compiled filerun cleaner
-> For eg, a directory hastry.cpp
delete.cpp
a.cpp
, then it should deletetry
delete
a
(sometimes i need this) if presentrun
-> Should run the last command it ran (may need storing in an output file)- MSVC cl command support
If anymore queries feel free to open an issue, or dm me on twitter
Whatever doubt you have even if why g++ main.cpp
doesn't work in multifile projects, you can contact directly :D