Scaffolding code for a simple C++ project
Complete sample code can be found here
Anatomy of make file
Targets are defined as labels
target: in the file and the automation tool (make or nmake) can be directed to run them by passing that label as an argument.
Compilation steps include creating object files for all source files and them combining them to create the final binary.
Clean tasks are simply removing all executables, objects and configuration files.
Sample program to get the OS name
Development and Build
Ubuntu 20.04 (make)
x64 target on x64 host using VS 2019 CL tool (nmake)
Follow the link to install vscode editor and VS 2019 c++ build tools
Open Developer command prompt for VS 2019
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat"
from a cmd prompt
Alternatively create a shortcut with following target
%comspec% /k “C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat” amd64
If you are using visual studio code then locate project directory and run
and use code’s
Build Task for the compilation.
config.bat to create build directory and moving appropriate make file and then run
Feel free to send me an email for any suggestion or feedback. Follow me on twitter and github.