Live Programming


Whenver I'm prototyping something new, I tend to create these three files, program.c, build.bat, and watch.bat

program.c contains the actual program that I'm prototyping.

build.bat contains the command that builds and runs program.c. For a simple C program it can be something like

clang test.c && a.exe 

watch.bat is the heart of this setup. It uses watchexec to compile and run the program whenever it changes. It usually looks like

watchexec -c -r -w program.c build.bat 
With this setup, whenever program.c changes, watchexec clears the console; shuts down the running program; recompiles it; then runs it again.

Here is how the setup looks like in action

Another setup with an actual GUI program can be found here. It doesn't use watchexec and is built using zig and raylib.

The immediate feedback makes this a more enjoyable programming experience.


Home Twitter Github