cw is a simple CLI tool that automatically compiles and runs C/C++ files whenever they are modified, saving you time and effort.
To install cw globally using npm, run:
npm install -g c_cpp-watcherPrerequisites:
Make sure you have a C/C++ compiler installed (gcc for C, g++ for C++). You can check by running:
gcc --version
g++ --versioncw <file.c or file.cpp> [compiler flags] [additional arguments]
cw main.cpp -Wall -std=c++17
This command watches main.cpp, recompiles it with -Wall and -std=c++17 flags, and runs the output.
- The compiled program automatically restarts when the file is modified.
- After execution, you can type rsand press Enter to restart manually.