I have a theoretical question about the difference between compile and build. I\'m programming in a c++ project that takes a lot of time to build, so I have told to do build
Build is the complete process of converting source code into an executable, for C++ compilation is the conversion of source code into object code. In a build the C++ code will be compiled and then you will need other stages including a link phase to construct an executable. Builds can also involve other steps e.g. preprocess or generating source code files before compilation.
Doing a build just in the cases in where "I have modified any header file" just means that only files that include (directly or via other included files) are compiled and then all objects are linked. Ina "full" build all files would be compiled so this will cut down on the number of files to be compiled and reduce the overall build time.
If you change a header file then you have to build, compiling would just create a new object file that is not yet part of the executable.