Prepare Your Development Environment

To get started C++ programming you should know something about C++ language and building tools. Please head on over to IsoCpp to get a hang of some ideas and piece of information on C++ infrastructure, recommended books, useful links, draft documents.

On the bumpy road to Cmakeland

To start coding together with me you need:

  1. Cmake
  2. One C++ compiler or more:smile:
  3. Ninja build-automation tool
  4. Graphviz
  5. Your favourite IDE with CMAKE support or the preferable text editor

The minimum CMake version 3.8 is required for this tutorial. Run quickly:runner: to your computer grab Cmake for your platform and install it. Download Ninja and plant it in your platform.

There are many good free C++ compilers you can use:

Install a compiler toolchain you prefer. Also there are many IDEs supporting a cmake project development. On:

My development environment

Here you find some hints concerning the installation process of individual elements of my developer’s tools. See here for more details.

Operating System

Windows 10 1809 64-bit

CMake + Ninja

Run cmake installer.
Cmake installation
During a cmake installation remember to tick any “add to path” option.
Cmake installation
Be quick on the draw:zap:!
To “install” ninja just copy a binary ninja.exe to Cmake/bin installation folder.

Clang

Clang
Grab Clang installer for your platform. Run it and setup Clang. Modify MSYS2 settings adding LLVM/bin to windows Path environment variable and your export in .bash_profile file
(export PATH=”/c/Program Files/LLVM/bin:/c/AddAnotherPathsIfNeeded/bin:$PATH”)

C++ Mingw-w64 toolchain

I decided to install Mingw-w64 toolchains as c++ toolkit. If you want to use them either follow simple steps.
To setup the Mingw-w642 environment, you need to:

  1. install MSYS2 and follow a instruction
  2. open MSYS2 MSYS terminal
  3. use pacman to install packages needed for c++ development

The following packages will be installed:

In your terminal type (copy/paste is OK too:smile:) line by line and press ENTER

pacman -S make gettext base-devel
pacman -S mingw-w64-x86_64-gcc
pacman -S mingw-w64-i686-gcc
pacman -S mingw-w64-x86_64-gdb mingw-w64-i686-gdb

To make cmake+ninja tools accessible in MSYS2 terminals modify your MSYS2 settings

Graphviz

Graphviz
Download Graphviz installer. Run it.
Remember to add Graphviz installation bin folder to Windows Path. To run graphviz tools in Mingw-w64 environment modify MSYS2 settings and add Graphviz/bin path to your export in .bash_profile file
(export PATH=”/c/Program Files/CMake/bin:/c/Program Files (x86)/Graphviz2.38/bin:$PATH”).

Additional software

  1. VS2017
  2. VsCode
    For VsCode users!
    To make your VsCode fully fledged C++ environment that supports cmake projects you need to install two additional extensions.
    Cpp for Vs Code
    Cmake for Vs Code
  3. QTCreator

Checkpoint

:muscle::wink::+1:

To check your “devel”:facepunch: environment run MSYS2 terminal and run clang, clang++, g++, cmake, ninja and dot.
clang g++ Cmake ninja
dot
Sneak a peek at my MSYS2 .bash_profile file:

export PATH="/c/Program Files/LLVM/bin:/c/Program Files/CMake/bin:/c/Program Files (x86)/Graphviz2.38/bin:$PATH

Phew we are done. :+1:
It' time for a coffee break

  1. You needn’t to install Visual Studio to use MSVC, you only have to install Microsoft build tools package (Microsoft C++ compiler + tools) 

  2. another way to install MSYS2 and Mingw-w64 tools is using the package manager for Windows Chocolatey

«Back
Next »