CPPDevOnWindows
                                
                                 CPPDevOnWindows copied to clipboard
                                
                                    CPPDevOnWindows copied to clipboard
                            
                            
                            
                        Best guide to setup C/C++ development environment on Windows
The definitive guide of setting up C/C++ development environment on Windows
I know a lot of you are having troubles of getting it to work on Windows and complaining a shiton. I will admit, that most C++ programming books do NOT actually tell you how to set things up. And I think that's hilarious, because how are you supposed to program without a working development environment? Although some books do mention it, they usually target Unix operating systems.
You can just use Visual Studio, which is the best and beginner-friendly solution and has really good documentation from Microsoft, but for some reason you are just a boomer and don't want to use it and you are dumb to set up the alternatives.
Now, you have found the right guide! This guide aims to provide the fullest list of every possible main-stream IDEs/text editors you might want to use and its respective configuration on Windows.
Follow the guide and screenshot carefully. The screenshot are from Windows Sandbox, which is a clean install of Windows 10. If you followed everything, and can't get it work, open an issue. Let me see how that's even possible!!
- The definitive guide of setting up C/C++ development environment on Windows
- Setting up development environment
- Download & Install a C++ compiler
- GCC & Clang
- Download & Install MSYS2
- Install GCC
- Install Clang
- What is MSYS2 and Why?
- What's the difference between /usr/binand/mingw64/bin
 
- MSVC
 
- GCC & Clang
- Download & Install CMake
- What is CMake and Why?
 
- IDEs
- Setting up CLion
- Setting up QT creator
- Setting up Cevelop
- Setting up Visual Studio
- Full package
- Standalone IDE
 
- Setting up Eclipse
 
- Text editors
- Setting up VSCode
- Setting up Vim
- Using MSYS2
- Standalone
- Optional plugins
 
 
 
- Download & Install a C++ compiler
- Source control
- Debugging
- Debugging in VSCode
- Debugging in CLion
- Debugging in Visual Studio
- Debugging in QT
- Debugging in Cevelop
- Debugging in Sublime Text
 
- Using libraries
- Setting up vcpkg
- Using a library
 
- Unit Testing
- Google Test
- Integration with Visual Studio
- Integration with CLion
- Integration with VSCode
 
- Microsoft Unit Test
- CTest
 
- Google Test
- Documentation
- Setting up doxygen
- Integrate doxygen with CMake
 
- Setting up a system-wide package manager
- Winget
- Chocolatey
- Scoop
 
- Setting up WSL
- Addtional Tooling
- Resharper
- Clang-tidy
- Integration with Visual Studio
- MSBuild Project
- CMake Project
 
- Integration with CLion
- Integration with VSCode
 
- Integration with Visual Studio
- ClangFormat
- Integration with Visual Studio
- Integration with VSCode
 
- Incredibuild
- C/C++ include guard (proud contributor)
- include-info (proud maker)
- VSCode Font switcher (proud contributor)
 
 
- Setting up development environment
Setting up development environment
This section describes the steps to
- Download & Install a C++ compiler
- Download & Install CMake
- Download & Install an IDE/text editor
- Create a project in various IDEs/text editors and start writing code
Download & Install a C++ compiler

This guide will cover the installation of GCC, Clang and MSVC.
GCC & Clang
Download & Install MSYS2
Just launch the installer and keep clicking "Next"
Install GCC
If you also want to install clang, skip this part and go directly to Install Clang,  because GCC is a dependency of Clang (on MSYS2) and will be automatically installed when you install clang.
- Run MSYS2, type the following command:
pacman -Syu
pacman is the package manager used by MSYS2. -S means "sync". -y means "download fresh package databases from the server". -u means "upgrade installed packages".
This command will update the packages info, so you get the latest packages. It will prompt you like this, and you type y and hit enter.

- Then it will prompt you To complete this update all MSYS2 processes including this terminal will be closed. Confirm to proceed [Y/n], typeyand hit enter, and it will close the window after the update is done.
- Relaunch MSYS2 from your start menu. Type:
pacman -S mingw-w64-x86_64-gcc
like this, type y and hit enter to install gcc

And then type:
pacman -S mingw-w64-x86_64-make
And type y to also install make.
And then type:
pacman -S mingw-w64-x86_64-gdb
And type y to also install gdb.
- 
Now search for environment variableand open it 
- 
Click Environment Variables, findPathinSystem variables, double click to open the setting. 
- 
Click Newand copyC:\msys64\mingw64\binto the new entry. 
- 
Click OKto close all windows. Now you finished installing GCC. Open any shell such ascmdand type ingcc --versionand you shall see the following: 
Install Clang
Installing Clang will also automatically install GCC (on MSYS2).
- Run MSYS2, type the following command:
pacman -Syu
pacman is the package manager used by MSYS2. -S means "sync". -y means "download fresh package databases from the server". -u means "upgrade installed packages".
This command will update the packages info, so you get the latest packages. It will prompt you like this, and you type y and hit enter.

- 
Then it will prompt you To complete this update all MSYS2 processes including this terminal will be closed. Confirm to proceed [Y/n], typeyand hit enter, and it will close the window after the update is done.
- 
Relaunch MSYS2 from your start menu. Type: 
pacman -S mingw-w64-x86_64-clang mingw-w64-x86_64-clang-tools-extra
like this, type y and hit enter to install clang

And then type:
pacman -S mingw-w64-x86_64-make
And type y to also install make.
And then type:
pacman -S mingw-w64-x86_64-gdb
And type y to also install gdb.
- 
Now search for environment variableand open it 
- 
Click Environment Variables, findPathinSystem variables, double click to open the setting. 
- 
Click Newand copyC:\msys64\mingw64\binto the new entry. 
- 
Click OKto close all windows. Now you finished installing clang. Open any shell such ascmdand type inclang --versionand you shall see the following: 
(9. Optional): If you want to get clang's implementation of the C++ standard library (ie. the STL), type this command:
pacman -S mingw-w64-x86_64-libc++
When invoking clang++, add the flag -stdlib=libc++.
The header files of libc++ will be stored at  C:\msys64\mingw64\include\c++\v1.
Note: Clang and GCC is installed to the same directory, eg. under C:\msys64\mingw64\bin. Don't be confused by the directory C:\msys64\clang64. It is an empty folder.
What is MSYS2 and Why?
MSYS2 is a collection of tools and libraries providing you with an easy-to-use environment for building, installing and running native Windows software.
But basically, we use its implementation of MingW(Minimalist GNU for Windows), which is a collection of common developing tools seen on GNU/Linux operating systems.
And please DO NOT follow this guide on Vscode's official tutorial, because the Mingw-w64 project provides an out-dated GCC toolchain. 
MSYS2 is actively maintained and provides an up-to-date GCC toolchain as well as many others.
What's the difference between /usr/bin and /mingw64/bin
Copied from this stackoverflow answer
The GCC compiler in /usr/bin produces executables that use msys-2.0.dll as a runtime dependency. That DLL is basically a fork of Cygwin, and it provides emulation of POSIX commands not normally available on Windows. That environment is mainly for running programs from the Linux world (like bash) which need POSIX commands and cannot be easily ported to a native Windows environment.
The GCC compilers in /mingw32/bin and /mingw64/bin produce native Windows executables targeting the 32-bit or 64-bit versions of Windows respectively. The 32-bit executables can actually run on 32-bit or 64-bit Windows. These executables are easier to distribute; you generally just copy all the DLLs that they depend on from the /mingw*/bin folder to the same directory as your executable, and then you have something that will run successfully on other computers. Since the main purpose of MSYS2 is to help write native Windows software, you'll find a much wider variety of libraries in the MinGW environments than in the msys-2.0.dll environment.
MSVC
MSVC is Microsoft Visual C++ compiler. And you know what? You do NOT have to install Visual Studio in order to get MSVC. However, if you also want Visual Studio, skip to setting up visual studio directly.
- Download MSVC, select Build Tools for Visual Studio 2019
- Launch the installer and select these workflows
 
- You have finished installing MSVC. Click Launchand typecland you should see this: 
Do NOT try to add MSVC directly to system PATH because each compiler toolchain for different architecture has its own version.
This command prompt is specific to 64bit Windows architecture and has set some temporary environment variables. You can find it in Start -> Visual Studio 2019 -> Developer Command Prompt for VS 2019 like this: 
After MSVC is installed, cmake can detect it as a compiler.
 

Download & Install CMake
You can either install CMake by using the official installer or using a package manager like MSYS2,
which you used to install GCC and Clang.
- Using the installer:
- 
Download here, choose the Windows win64-x64 Installeroption
- 
Launch the insatller, when you see this screen, choose Add CMake to the system PATH for all users Now you finished installing cmake. Now you finished installing cmake.
 
- 
- Using MSYS2:- Run MSYS2and type this command and typeYto install
 pacman -S mingw-w64-x86_64-cmake- Search for environment variableand open it ->Environment Variables, findPathinSystem variables, double click to open the setting -> clickNewand copyC:\msys64\usr\binto the new entry. 
 
- Run 
What is CMake and Why?
CMake is a cross-platform build-system generator, which generates build files (some files dictating how your source files should be built) for your platform.
For example, on Windows by default, it generate Visual Studio Solutions (which is some files dicating how your source files should be built, native to Visual Studio) if you have Visual Studio installed. On Linux by default, it generates Unix Makefiles (which is some files dictating how your source files should be built, native to make).
And because:
It is a bug if your C/C++ project does NOT provide CMake support.
In reality, some of the most loved IDEs/text editors really just provide good CMake support out-of-the-box. So don't argue that Meson is better or some nonsense. To be considered "better", you really have to get good tool chain support.
IDEs

This guide will cover setting up Visual Studio, CLion, QtCreator, Cevelop (based on Eclipse) and Eclipse.
Setting up CLion
- 
Download clion 
- 
Launch the installer, keep clicking "Next". When you see the following screen, I strongly recommend you to select Add "Open Folder as Project". 
- 
Run clion, set up the appearance as you like, login your account or free trial. 
- 
After those, it will prompt this window for setting up compilers, it should be all correct and no need to change.  
- 
Create a new C++ executable or C executable on the left  
- 
Clion will auto generate a "Hello world" project and everything should be working.  
Setting up QT creator
- Download QT installer here
- Launch the installer and you will need to either sign in or create a qt account
- When you see this, click Custom Install. 
- When you see this, click Deselect All, because we only intend to use it as a standalone IDE, akaQt Creator. If you want to do Qt development, select the component to your need. 
- After the installation, run Qt Creator->New File or Project->Non-Qt Project->Plain C++ Application(this actually doesn't matter, you can always change to a C application in theCMakeLists.txtfile) -> ChooseCMakeas the build system -> selectall kits(this will include the different build types in CMake).Qt Creatorshould create a simple "Hello world" program for you, like this:         
- Click the Runbutton, and it should run 
Note: If there is error during CMake's configure, go to Tools -> Options -> Kits -> Desktop(default), and make sure the C and C++ compiler is in C:\msys64\mingw64\bin instead of C:\msys64\usr\bin.
 

If you installed Clang you shall see it in the compiler selection menu:

Setting up Cevelop
- 
Download and install Java Runtime Environment, select Windows Offline (64bit)
- 
Download Cevelop, select Windows.
- 
Extract Cevelop and run cevelop.exeIf you see this  , you may incorrectly installed the 32 bit version of Java Runtime Environment! Go back and reinstalled the 64 bit version! , you may incorrectly installed the 32 bit version of Java Runtime Environment! Go back and reinstalled the 64 bit version!
- 
The first time running it, it will prompt you to choose a default workspace directory. Change it to where you like. Click File->New->C/C++ Project->CMake Project->Finishlike this:     
- 
Click Runto run. 
Setting up Visual Studio
You can install Visual Studio as a standalone IDE or as a whole package including compiler, toolchain and windows sdk.
Full package
- 
Download Visual studio. Choose the Communityoption.
- 
Run the installer, select these workflows  
- 
After installation, you are prompt to restart your computer. And then you will need to register a Microsoft Account to continue using Visual Studio. 
- 
Run Visual Studio, select Create a new project->Empty Project/Console App, and selectPlace solution and project in the same directory.     The only difference between The only difference betweenEmpty ProjectandConsole Appis the latter will provide you with a "Hello world" program and that's it! All the default include directories and default linked runtime libraries are the same!
- 
If you choose to create Empty Project, right click on the<Project Name>->Add->New item->C++ source file->Add, like this:   Then write a simple "Hello world" program and hit Then write a simple "Hello world" program and hitctrl+f5to compile and run it, and you shall see this: 
- 
If you choose to create Console App, you shall see the already created "Hello world". Hitctrl+f5to compile and run the program and you shall see this: 
Standalone IDE
If you install Visual Studio as a standalone IDE without installing MSVC compiler toolchains, you can use it with CMake. If you have installed MSVC compiler toolchain, you can use it with Visual Studio solution just as it's a full install like above. Here I introduce how to use it with CMake, without MSVC.
- 
Download Visual studio. Choose the Communityoption.
- 
Run the installer, select these workflows and deselect all the optionals on the right, like this  
- 
After installation, you need to register a Microsoft Account to continue using Visual Studio. 
- 
Run Visual Studio, select Create a new project->CMake Project-> selectPlace Project under the same directory->Create, like this:     
- 
Visual Studio will auto generate a "Hello world" project for you, and it can successfully configure the project and compile because CMake can detect the installed GCC. However, it will have incorrect include errors. 
- 
To solve this error, click on the configuration menu -> Manage Configurations-> click the add button -> selectMingw64-Debug-> click on the previous old configuration and click delete button     
- 
Hit ctrl+sto save this configuration, then the include error should go away. 
Note: If for some reason, Visual Studio doesn't detect the right MingW version, you will still get include errors. You need to edit the CMakeSettings.json and correct the MingW version, like this:
 

Setting up Eclipse
Text editors
Setting up VSCode
- 
Download vscode 
- 
Launch the installer, when you see this screen, I strongly recommend you follow this setting  
- 
Run vscode, in the extensiontab, search and install the following extensions
- Install Microsoft C/C++extension, It is a Language Server by Microsoft. You can also install llvm's LSPclangd.clangdwill have limitions when using with Visual Studio as CMake's generator. See the discussion here.   
- And 2 extensions for cmake. The first one in the list is for syntax highlighting when writing cmake scirpts.
- The second one in the list is for actually running Cmake.
 
- 
Go to settings, search generator. And setCmake:GeneratortoMinGW Makefiles, like this: 
- 
Create a folder, open it in vscode. Use ctrl + shift + pto open the command menu, typecmakeand chooseCMake: Quick Start, like this: 
- 
The cmake tool will scan the kits and there will be 2 kits. Select the first one.  
- 
Type a name for your project, select Executable, CMake tool will automatically generate a helloworld project for you. And you probably don't want to enable ctest for now, so delete everything excpet the following 3 lines: 
Rememeber to click Allow when cmake want to configure the intellisense.
- And now you can run it and debug it, and have everything working (syntax highlighting, auto complete, header files...).
     
Setting up Vim
Using MSYS2
- If you install viminMSYS2, your.vimrcfile should be placed inC:\msys64\home\<UserName>\.vimrc
- Create new folders along this path
 and then openC:\msys64\home\<UserName>\.vim\autoloadpowershellhere.
- Type the following command to install vim-plug, a simple vim plugin manageriwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |` ni plug.vim -Force
Standalone
Download and install Vim here. It can be installed by keep clicking "Next" in the installer. (Note: Recommended method to install vim is through a package manager, see here)
- Install vim-plug
iwr -useb https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |`
    ni $HOME/vimfiles/autoload/plug.vim -Force
Open .vimrc, add these following lines:
filetype plugin indent on
set tabstop=4 " show existing tab with 4 spaces width
set shiftwidth=4 " when indenting with '>', use 4 spaces width
set expandtab " On pressing tab, insert 4 spaces
syntax on
set nu " Enable line numbers 
set smartindent
call plug#begin('~/.vim/plugged') " List all the plugins to be installed
Plug 'neoclide/coc.nvim'
call plug#end() " End of plugins
- 
Install coc-clangd, the C++ language client extensionOpen whatever C++ file, and type command :CocCommand clangd.install
- 
Install clangd, the actual C++ language server.Type command :CocCommand clangd.install.
- 
Now you should have auto-complete working.  
Optional plugins
All the plugins listed below can be installed by adding Plug '<plugin-repo>' betweeen the call plug and call plug lines in the .vimrc file.
- vim-airline An enhanced status line.
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes' 
 2. nerd-tree
A file explorer.
2. nerd-tree
A file explorer.
Plug 'preservim/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
Plug 'ryanoasis/vim-devicons'

- startify
A welcome screen for quick opening recent folders and projects
Plug 'mhinz/vim-startify' 
Source control
Most if not all of the development workflow involves using Git.
Also, some of CMake's functionalities requires Git to be installed.
And you also need Git to install vcpkg.
You can install Git either by using the installer or using a package manager,
like MSYS2 which we just used above to install GCC and Clang.
- 
Install by using the installer - Download the installer here and then it can be installed by keep clicking Next. 
 
- Download the installer here and then it can be installed by keep clicking 
- 
Install by using MSYS2- Run MSYS2, type in the command
 pacman -S gitAnd then type Yto install.- Search for environment variableand open it ->Environment Variables, findPathinSystem variables, double click to open the setting -> clickNewand copyC:\msys64\usr\binto the new entry. (You don't need to do this again if you installed CMake using MSYS2) 
 
- Run 
- 
Install by using a package manager - chocolatey: choco install git
- scoop: scoop install git
- winget: winget install git
 
- chocolatey: 
Debugging
This section describes how to debug in various IDEs/text editors.
Debugging in VSCode
To launch the debugger in VSCode, click the cmake project menu -> right click on the <target name> -> Debug like this: 
See more documentation for VSCode's debugging UI here, except for the part that sets launch.json because the CMake tools already handles everything :)
Debugging in CLion
To launch the debugger, click here 
For more, see documentation here
Debugging in Visual Studio
Debugging in QT
Debugging in Cevelop
Using libraries
Setting up vcpkg
vcpkg is a C/C++ package manager, which makes using libraries much easier (almost as easy as using pip in python).
~~You HAVE TO install MSVC or Visual Studio on Windows to use vcpkg.
(Mingw GCC CAN NOT be used to build vcpkg on Windows at the time being).
After MSVC is installed, you can follow the guide here
to set it up.~~
Starting from this commit, vcpkg binary can be
directly downloaded by running bootstrap-vcpkg.bat, you no longer need to install MSVC to build it!
- Open a shell(cmd) and go to the directory where you wantvcpkgto be installed. (Something likeC:\orC:\dev)
- Type this command:
git clone https://github.com/microsoft/vcpkg
- Type this command:
.\vcpkg\bootstrap-vcpkg.bat
- Type this command:
.\vcpkg\vcpkg integrate install
Using a library
After you install the library in vcpkg, you either:
- Use Visual Studiowithout ANY ADDITIONAL CONFIGURATION
- Use cmakewith the instruction provided byvcpkgwhen you install the library.
Below is a complete example of using vcpkg to install and use the boost library.
- 
Install the library in vcpkgwithvcpkg install <Library Name>, like this:vcpkg install boost:x64-windowsNote that vcpkgwill build 32 bit libraries by default on Windows (although it's 64 bit on Linux by default,~~Microsoft fix it please~~), which is NOT probably what you want, so you want to speficy the architecture by adding:x64-windows. And you should see the following 
- 
Note that on Windows, vcpkgbuilds libraries usingMSVC, so you should also useMSVCin order to link sucessfully. Header-only libraries likeboostmay be used with other compilers likeGCC.
Afrer the library finishes installing, you can either:
- 
Use it in Visual Studio without doing any additional configuration  Note: Configure the solution achitectural target correctly according to your library. Visual Studio empty project defaults to Note: Configure the solution achitectural target correctly according to your library. Visual Studio empty project defaults tox86but you may installedx64library.
- 
Or use it in VSCode/CLion with cmake and cmake tool chain file. See the docs here 
Unit Testing

Google Test
google test is a famous and widely supported by IDEs/text editors unit testing framework for C++.
You can get google test by these ways
- 
Using vcpkg: Following setting upvcpkg, we can easily install the library byvcpkg install gtest:x64-windowsNote that if your application is targeted to 32 bit, use this command instead vcpkg install gtest
- 
Using MSYS2: Note that this can only be used withGCC & Clangcompiler fromMSYS2.pacman -S pacman -S mingw-w64-x86_64-gtest
After installing the library,
- 
If you use Visual Studio (MSBuild Project), you just need to #include <gtest/gtest.h>like a normal C++ source file and either:- 
Provide a mainfunction at the bottom of your source fileint main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } 
- 
Don't provide a mainfunction, then you need to link additional libraries in the linker settings.- Right click on your project -> Properties->Linker->AdditionalDependencies, Make sure this configuration isDebugandx64(or x86 depend on the architect or your installed Gtest library) and add these 2 lines
 gtestd.lib $(VcpkgRoot)installed\$(VcpkgTriplet)\debug\lib\manual-link\gtest_maind.lib - Click the configuration menu to Releaseand also add these 2 lines, like this
 gtest.lib $(VcpkgRoot)installed\$(VcpkgTriplet)\lib\manual-link\gtest_main.lib Then you should be able to write the test source file without the mainfunction, and build in both configurations like this- Debug build
 
- Release build
 
 
- Right click on your project -> 
 
- 
- 
If you use CMake, regardless of whether you installed Google Testlibrary fromvcpkgorMSYS2, you can make use ofCTestbuilt-in to Cmake as a test runner to run your google test, which is supported by most IDE/editors you will see below. A minimumCMakeLists.txtis like:
cmake_minimum_required(VERSION 3.10.0)
project(<project name> VERSION 0.1.0)
find_package(GTest CONFIG REQUIRED)
enable_testing()
include(GoogleTest) #for gtest_discover_tests() function
add_executable(<test target name> test.cpp) #This is the testing executable
target_link_libraries(<test target name> PRIVATE GTest::gtest GTest::gtest_main) #Link it to the google test library
gtest_discover_tests(<test target name>)  #integrate google test with ctest to this testing executable
- Or you simply want a testing executable, so you don't bother with CTest.
cmake_minimum_required(VERSION 3.10.0)
project(<project name> VERSION 0.1.0)
find_package(GTest CONFIG REQUIRED)
add_executable(<test target name> test.cpp) #This is the testing executable
target_link_libraries(<test target name> PRIVATE GTest::gtest GTest::gtest_main) #Link it to the google test library

Integration with Visual Studio
Integration with CLion
CLion has test adaptors built-in so it should automatically detect the test whether you are using CTest as runner or just simply compiling a testing executable.
- With CTest 
- Without CTest 
You can click the run button on the left of each TEST() macro to run individual test, or click ctrl+shift+f10 to run all test.
See here for more documentation.
Integration with VSCode
You need to use CTest (the first version of the minimum CMakeLists.txt) as your test runner to get the integration working.
- Install the CMake Test Explorer extension (proud contributor)
- Open VSCode settings, go to Extension->CMake Test Explorersection, and change these following settings:- Build Config: ${buildType}
- Build Dir: ${buildDirectory}
- Select Cmake Integration
 
 
- Build Config: 
- After that, build your project once and then click the refresh testbutton, this plugin should find all the testing suites and test cases in your test files. 
- Then you can easily manage or debug all your test cases or each individual test in this panel.
 
Microsoft Unit Test
CTest
Documentation
Setting up doxygen
Writing good documentation is also an essential part of development. The most commonly used documentation generator is doxygen. Download the binary distribution for Windows and then install it. After it is installed, there will be a GUI frontend called doxywizard, which looks like this:
 To write good documentation, install these plugins:
To write good documentation, install these plugins:
- For VSCode (proud contributor)
- For Visual Studio
Learn the syntax for documentation here
After you documment your code, any decent IDEs/text editors should be able to show the documentation, helping you better understand your own code as well as others.
 

Using doxygen is straight-forward using the GUI, just specify the root directory of your project, configure some settings to your liking, then run it.

Doxygen generated documentation too ugly? Follow the guide here to use doxygen with sphinx for a more beautiful documentation.
Integrate doxygen with CMake
You can set up an automatic documentation generation step within CMake, so that each time you build your cmake project,
the docs would be generated or updated.
To do that, assuming you have a doc directory in your project, something like this
MyProject
|--doc
|--README.md
|--CMakeLists.txt
|...
add the following snippet to your root CMakeLists.txt
find_package(Doxygen)
if(DOXYGEN_FOUND)
    set(DOXYGEN_USE_MDFILE_AS_MAINPAGE "${CMAKE_SOURCE_DIR}/README.md")
    set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/doc")
    set(DOXYGEN_EXCLUDE_PATTERNS "<your binaries or other files generated by your IDE>")
    doxygen_add_docs(doc ${CMAKE_SOURCE_DIR} ALL) #this will create a target called "doc"
    #You can either manually run the target or it will automatically run when "cmake --build ." is called
endif()
Setting up a system-wide package manager
Package manager makes it easier to install and update softwares, allowing you to use one single command to update all installed softwares.
On Windows, there isn't one come by default (actually Microsoft store), but that does NOT mean there aren't good ones.
I recommend installing those frequently updated software that doesn't have a built-in updater
(like cmake, vim...)
using a package manager.
Winget
Install and docs here
Chocolatey
Install and docs here
Scoop
Install and docs here
Setting up WSL
Setting up WSL is the same as setting up a pure linux environment, therefore it is not discussed here.
Addtional Tooling
Resharper
is a non-free extension for Visual Studio that can greatly benefit your productivity. Download here.
Clang-tidy
Clang-tidy is a C++ "linter" that provides extra warnings and style checks to your C++ compiler.
Integration with Visual Studio
Clang-Tidy support is available starting in Visual Studio 2019 version 16.4. It's included automatically when you choose a C++ workload in the Visual Studio Installer. More info.
MSBuild Project
- Right click on project -> Properties->Code Analysis->Clang-tidy 
- In Checks to Enable or Disable, you can configure checks to be enabled or disabled using supported flags. To enable a check, add the flag name directly. To disable a check, prefix with a-. Flags are separated by comma. For example:*enables all checks.-clang-analyzer-*disables all checks namedclang-analyzer....
- Build your project, and you should see warnings provided by clang-tidy.
 
CMake Project
- Click on build configuration menu -> Manage Configuration->Edit JSON 
- Add a key named enableClangTidyCodeAnalysisand set value totrue. Optionally control which checks to be enabled or disabled by adding a key namedclangTidyChecks 
- Save and exit. Now you should see warnings provided by clang-tidy.
 
Integration with CLion
Integration with VSCode
Install this plugin.
ClangFormat
ClangFormat is a code formatting tool to help your code follow some pre-defined formatting rules.
In all IDE/editors, the actual ClangFormat executable needs to be installed first.
Integration with Visual Studio
- Install this plugin at the bottom "Visual Studio plugin installer"
- Then you can find settings in Tools->Options->LLVM/Clang->ClangFormat 
Integration with VSCode
ClangFormat is supported by VSCode C++ extension out-of-the-box.
ClangFormat settings can be found in C++ extension settings.

Incredibuild
is a free-for-personal-use build tool that accelerate visual studio's project building. It also provides a nice graph to visualize the building process and time consumption of individual files.

It can be installed when installing visual studio. Download the license here.
C/C++ include guard (proud contributor)
is a VSCode extension that automatically add include guard for you so that you no longer need to remember it. Download here.
include-info (proud maker)
is a VSCode extension that shows the included header file size and provide a fast way to jump to those included files. Download here
VSCode Font switcher (proud contributor)
is a VSCode extension that provide a fast way to switch between different fonts. Download here.