Compiling C/C++ code on the raspberry pi is very slow, I have some code I am writing that compiles in less than 5 seconds on the laptop but can take 30 minutes on the raspberry pi. This is pretty annoying and slows down testing of code tweaks.
I have found a way of automating this quite successfully via Clion (Commerical software from Jetbrains).
Raspberry pi tools
Firstly we need to get the raspberry pi compile toolchain.
Git clone this somewhere on your local filesystem.