CLion 2019.1 Help

Quick Tutorial: Configure CLion on Windows


Currently CLion supports the following environments that include compilers and additional sets of tools needed for the development purposes:

  1. Cygwin.

  2. MinGW.

  3. Windows Subsystem for Linux.

  4. Microsoft Visual C++.

When you start up CLion, it will attempt to actively detect your existing operating environment automatically. So, if you have your environment (MinGW, Cygwin, Microsoft Visual C++ or/and WSL) installed already, CLion will do its best to locate those by itself. To check it up, open the Toolchains settings dialog (File | Settings | Build, Execution, Deployment | Toolchains and expand the Environment drop down list: it must contain all the environments deployed on your machine and detected by CLion. There might be cases where it will not succeed though — such as in the case of missing packages or unsupported versions.


Both the installation and upgrade of Cygwin happen from the executable you download on the Cygwin download page. After firing up the installation and choosing the install directly (e.g., c:\cygwin64 for 64-bit), you need to pick the packages to install. The packages that CLion needs are:

  • gcc-g++

  • make

  • GDB

Alternatively, you can just install the gcc-g++ and gcc-core packages. These two packages, make and GDB have all that CLion needs.

To install a package, simply search for it in the Select Packages window and click the name until a tick mark appears in the Bin? column:

Cygwin installation

Once you’ve installed Cygwin, open CLion’s settings in File | Settings and navigate to Build, Execution, Deployment | Toolchains. From the drop down list of available environments, choose Cygwin. Specify the path to Cygwin or select the preferred Cygwin installation from the list. CLion will validate your settings and, if everything is OK, will present the following:

Cygwin toolchain


You can use MinGW instead of Cygwin as the operating environment that CLion can use. MinGW can be installed in many ways: you can install the official distribution, the mingw-w64 distribution or, alternatively, one of the pre-made distributions such as TDM-GCC. In this guide we will take a look at the default distribution only.

To install MinGW, go to the downloads page and download mingw-get-setup.exe. This executable will help you install all the required packages that CLion needs to operate.

Fire up the installer and pick your path (e.g., c:\MinGW). Now MinGW will go off and download a database that lists all available packages that can be installed. You will then be presented with the Installation Manager window where you need to pick at least the packages shown below:

MinGW installation
Now, simply choose Installation | Apply Changes from the menu, press Apply in the dialog that opens and wait for the packages to download and install.

Once you have completed MinGW installation, you can go to the Toolchains settings dialog (File | Settings | Build, Execution, Deployment | Toolchains) and set up MinGW as your working environment, as it is described in our manual.

Windows Subsystem for Linux

If you are a Windows 10 user (least supported version is Fall Creators Update 1709, build 16299.15), you can use Windows Subsystem for Linux in CLion. With WSL you can create Linux toolchains for building your project on Windows machine and operate you prefered Linux distribution at the same time. All you need is to download and install WSL on your system and select it as working environment in CLion:

cl WSL Credentials
For more details on how to install and configure WSL refer to our manual.

Microsoft Visual C++ compiler

In addition to MinGW or Cygwin as operating environments for CLion, you can try using Microsoft Visual C++ compiler. CLion supports that compiler with CMake and NMake generator. With Microsoft Visual C++ you are able to work with the various cross-platform projects which often use Microsoft Visual Studio under Windows as a working environment.

To begin with, you need either Visual Studio 2013, 2015 or 2017 to be installed on your system. Having that, configure CLion to use Visual C++ compiler:

  • Set up Microsoft Visual C++ compiler as your environment. Go to the Toolchains settings dialog (File | Settings | Build, Execution, Deployment | Toolchains) and select Visual Studio from the list of available environments. Note, that CLion automatically detects the Visual Studio version installed on your system.

    cl toolChainsMSVC

  • Specify the architecture (x86, amd64, x86_arm, amd64_arm, etc), type of a platform (store or uwp or leave it blank) and version (Windows SDK name or leave it blank).

  • That's all. Now you can build your project with MSVC and run it. Note, that CLion will run CMake with the NMake generator in this case.

Diagnosing Problems

CLion tries its best to indicate whether or not a particular part of the required infrastructure is configured. If you attempt to compile without a predefined toolset, you will get an error similar to the following:

cl WinTutorialDiagnistics
Similarly, if you neglect to install one of the constituent parts, the Toolchains option page will perform the requisite validation and will indicate which part is missing:
cl toolchains failed


There are two essential tools that CLion needs. First is CMake, which is used as the project/build system: think of it as an alternative to other popular build systems such as MSBuild (used by Visual Studio) or Qmake. CMake is fundamentally different to, say, Visual Studio in that CMake is not really a build system: instead, it is a build generator that produces build scripts in different formats, Visual Studio included. As a consequence, CMake does not have the equivalent notion of a solution: instead, several different binaries can be built out of a single CMakeLists.txt file as different targets.

You can find out more about CMake in our CMake Tutorial.

CLion comes bundled with a compatible version of CMake. As an alternative, you can specify a path to your own CMake distribution. You can download a distribution of CMake here.

While CMake tries to be very generic, you can get it to perform actions specific to a particular operating system. For example, the following clause will only be invoked in a Win32 setting:

if (WIN32) #do something endif (WIN32)


On Windows, CLion uses GDB for debugging your C/C++ applications.

If you are using MinGW, CLion comes with bundled GDB (version 8.2). For Cygwin, you will need to install the appropriate package in the Cygwin Package Manager, as described in the Cygwin section of this guide.

Also, you can use a custom GDB binary instead of the bundled one. In this case, mind the supported versions: GDB 7.8.x-8.2.x.

Running and Debugging a Program

In order to run a program, you first need to make sure that you have both a target that gets built as well as a configuration that gets executed. A configuration is essentially a specification of what gets executed and how. If you open an existing project, a configuration will be created for each target automatically (see this tutorial for further info on run/debug configurations). If you want to change an existing configuration or create a new one, choose Run | Edit Configurations… in the menu. The configuration editor looks as follows:

cl WInTutorialRun

For a configuration, you need to specify the target, the CMake profile and the actual executable that you are going to run. There’s also scope for specifying additional parameters.

Once you are done, you can run a program either by choosing Run | Run, pressing Shift+F10 or pressing the artwork icons run play button in the menu bar on the top right of the window:

cl WinTutorialTriangle

Note that running the app does not start a debug session. To start debugging, choose Run | Debug, press Shift+F9 or press the bug icon in the above menu bar. When execution pauses, an additional debugging tool window opens:

cl WInTutorialFrames

This tool window lets you inspect the internal state of the variables in different threads, set watches, evaluate expressions and a lot more. The GDB tab shows the GDB console output.

Debugging a program works the same as in other IDEs: you set the breakpoints (click on the margin or press Ctrl+F8) and then, once the debug session is initiated, execution gets paused at the breakpoint.

Last modified: 24 July 2019

See Also