Not many people associate words “handy”, “neat”, or “sweet” with C++. I am one of those who does.

C++ programming is for everyone and it is fun. Most C++ books however dive directly into the language, without paying much attention to the development environment. This leaves a novice programmer with extra effort to choose “right” tools, compatible with each other, to form a solid development toolset.

In this post let me share a toolset that works for me and makes my C++ experience great.

To make the narrative more complete, let me say a few words about Linux. For many years during my research in physic, Linux was my primary environment. It is fascinating to have hundreds of powerful utils waiting behind the terminal window to solve any task. Losing that Linux-terminal sort of power was a nightmare for me and therefore migration to another OS not an option. Unless, there appeared Windows Subsystem for Windows (WSL). It brings a whole Linux world into Windows. The integration is so great, that Windows + WSL replaced Linux on my laptop. Pure Linux is what I keep using on servers.

This is a short story why I demand my C++ projects to compile natively on Linux and Windows. (Next on my demand list is x64 and ARM64 compatibility. I have not experiment with this yet due to lack of decent ARM64 hardware.)

1. Terminal

Windows Terminal is a modern terminal for Windows.

If browser is the most used application on my PC, then terminal takes a solid 2nd place. Install it from App Store and enjoy in tandem with WSL!

2. Development

Microsoft Visual Studio is the most advanced IDE for C++ development.

No other IDE offers so rich set of tools mutually integrated with each other and operation system. It is extremely well integrated with Linux (WSL) and its tools, so that we can compile and debug native Linux applictions from Windows. All this thanks to engeeniers from Miscrosoft, which invest huge effort to integrate both worlds. Very impressive and noticable in VS2022.

  • Compiler
  • Debugger / Profiler
  • Linux integration (WSL)
  • Build system (CMake for Linux / Windows)

3. Build system

CMake is defacto a standard build system for C++.

It runs on Windows, Linux, and many other systems. It is a part of VS installation on Windows.

4. External Libraries

vcpkg is an open-source package manager for C++ from Microsoft.

The best way to use popular C++ libraries in your project. It is integrated with CMake and works on Linux / Windows.

It is very easy install and use:

  • Install vcpkg

     $ cd %USERPROFILE%/Sources
     $ git clone https://github.com/microsoft/vcpkg.git
     $ ./vcpkg/bootstrap-vcpkg.bat
    
  • Install Packages

    Now we can install packages and use them within CMakeLists.txt in our project.

    Two libraries I link at the very beginning are

    • docopt for neat command-line interface
    • spdlog for handy logging

    $ vcpkg install --triplet=x64-windows-static docopt spdlog
    

    I prefer static linking as final executable is not bind with local files. This allows to copy our program to any machine without worrying to install dependencies there.

  • Update vcpkg

    Do not forget to update vcpkg from time to time as new packages or updates may become available.

    $ cd %USERPROFILE%/Sources/vcpkg
    $ git pull
    

Summary

My C++ toolset that guarantees great development time: