Roberto Aley

menu

cmd

Expanding subdirectories in a batch file

8/24/2021

When I am working on C++ projects the way I compile my projects is by creating a shell script or a batch file and compiling the whole project every single time. Many C++ developers might not like this approach arguing that it increases compiling times substantially but in my experience this is not an issue if you write code in a sensible way without abusing features like templates and many other ways you can help the compiler be faster when compiling your code. The other approach is to use some build system like GNU Make or any of the other existing solutions. I find the script approach simpler even though it has its caveats like the one I'm going to talk about.

If I'm compiling on Windows I need to pass the .cpp files to MSVC compiler so it know where the definitions of my functions are, something like this:

cl src\\\*.cpp

and this will work if you have all your .cpp files in src/ in this case. But if yo...