CLion and Linux toolchain on Windows are now friends!

In this post we’ll discuss how to work with WSL in CLion and how Windows users can benefit from this support.

Why do I need it?

CLion is a cross-platform IDE, that means you can run it on Windows, Linux, and macOS. From the very beginning it works with GCC and Clang compilers, which means on Windows it requires Cygwin or MinGW (or MinGW-w64). Later we introduced Microsoft Visual C++ compiler support, for those users who have it installed and want to use inside CLion on Windows.

Besides, we know that there are C++ developers who have Windows desktops but require Linux toolchain for building their projects. Cygwin could be a work-around. With Windows 10 Microsoft however introduced an even better way – Windows Subsystem for Linux. You simply get the prefered Linux distribution (Ubuntu, OpenSUSE and SLES are supported), configure the WSL and enjoy your new Linux environment in Windows. And now you can benefit from it in CLion!

That means the following is possible:

  • Configure WSL toolchains in CLion on Windows
  • Use CMake, C, and C++ compilers from Linux in CLion running on your Windows machine
  • Debugger support is available
  • Catch memory errors and leaks right from the IDE with the Valgrind Memcheck integration


Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables natively on Windows 10. Let’s start with the simple instruction on how to set it all up:

  • Update your Windows 10 machine to the latest “Fall Creators Update” (mininum version 1709, build 16299.15).
  • Install WSL distribution, for instance Ubuntu.
  • Run Ubuntu, create a new user, keep in mind username:password.
  • Setup Ubuntu WSL environment:
    • install cmake, gcc, or/and clang,
    • configure and run openssh-server.

    Check script that can help you with the configuration:

    If you are using Linux distribution different from Ubuntu, you might need some adjustments to the script.

  • To check the ssh connection, run the follow command in your WSL distribution: ssh username@localhost -p <port_number> (2222 in case of our script)

Full instruction on our confluence page.

Configure WSL toolchain in CLion

Starting with the CLion 2018.1 EAP you can use WSL as a toolchain in CLion. Go to Build, Execution, Deployment | Toolchains and select WSL in the environments dropdown:

Configure remote credentials (provide port, username and password):

Check if everything is connected and working, CMake, C, and C++ compilers are detected and available to use:

Known issues and limitations

  • There is a known issue is with the mixed case-sensitivity. Due to the IntelliJ platform issue, there is an issue with WSL file-system which is case-sensitive and Windows FS which is not. As workaround you can pass properties (Help -> “Edit Custom Properties…”):, restart an IDE and rebuild the project index (File -> “Invalidate Caches and Restart”) after that.

That’s it! And a short demo at the end:

What’s next

WSL support is a first step to implement full remote development support in CLion. It’s planned to work over ssh, just the same way the WSL now works in CLion, and will be available on all platforms.

We encourage our Windows users to try out the new WSL toolchains support in CLion, and report any issues they find to our bug tracker.

Your CLion Team
The Drive to Develop

This entry was posted in Announcement, Early Access Preview, Tips'n'Tricks and tagged , , , , , . Bookmark the permalink.

49 Responses to CLion and Linux toolchain on Windows are now friends!

  1. Mats Brorsson says:

    This is great news. But how can you get the EAP versio to use the same license as the regular one? I cannot find an option to enter activation code.

  2. Christian says:

    Should we be able to select an WSL instance which is not within AppData/… ?
    There’s a […] Button but it’s disabled for me, so I cannot select my WSL instance located in C:/Linux/ubuntu

  3. Evangelos Karafantalos says:

    I’m trying to test WSL feaute but I keep getting “Credentials are not valid for this WSL distribution(Ubuntu).”

    However I can normally ssh both from putty and withing WSL.

    Bear in mind I’m using a custom port(changed correctly) for ssh and my username is case sensitive(I’ve also added the custom property).

    WSL Version: Ubuntu 16.04.3 LTS as reported from Clion.

  4. Arty says:

    Really looking forward to custom paths for Cmake and compilers. WSL Ubuntu ships with Cmake 3.5.1 which is too low for most of our projects (we use 3.8)

    • vasily_romanikhin says:

      1. As temporarily solution you could try to replace the original cmake with your custom cmake using symlinks.

      2. Here’s the issue for your requirement:

    • Christian says:


      I had also problems with the old CMake version. For the latest build (2018.1 RC build 181.4203.505) you can change the CMake path in the settings of the WSL toolchain (File | Settings | Build, Execution, Deployment | Toolchains).

      Note: You can change the parameters for CMake in the settings too (File | Settings | Build, Execution, Deployment | CMake). Make sure to choose the WSL toolchain.

      I am very pleased with this toolchain, since it replaces an annoying toolchain for me (WSL running an XServer that serves CLion to an XClient running on Windows itself).

  5. yuanhonglong says:

    I followed all the steps,but when I run :
    ssh sworddestiny@localhost -p 2222
    I get an error :
    ssh: connect to host localhost port 2222: Connection refused

    • yuanhonglong says:

      and Clion can not connect to my WSL :(

    • Vasily Romanikhin says:

      Which WSL distribution do you use?

      If it’s not critical for you I’d recommend to reinstall Ubuntu WSL-distribution and use this instruction (

      If it doesn’t help please check your Firewall (or other Antivirus software) settings, it can block ssh connection.

      • Vasily Romanikhin says:

        > and Clion can not connect to my WSL

        It’s predictable, because your ssh connection is configured properly.

      • yuanhonglong says:

        I use windows 10 version 16299.309. My WSL is ubuntu. I closed the firewall and reinstalled my WSL.B!U!T! Nothing good.

        I have used ubuntu for years.I followed all the instructions and checked the output. I think some (ipv6) network error happened. Maybe I should change my software source (I’m a Chinese),or change the sshd config to listen the ipv6 network.

        Unfortunately, I have no more time. So I just delete my WSL. Ubuntu desktop is much better than WSL, isn’t it?
        (By the way, I also have Mingw. I can use Clion both in Windows and Ubuntu desktop. Why I must use WSL?)

        • Vasily Romanikhin says:

          > Ubuntu desktop is much better than WSL, isn’t it?
          It depends, some people prefer Windows (or they have to use Windows) and in the same time they need Linux development environment. In that case WSL is good alternative to virtual machine.

          > Why I must use WSL
          You don’t have to use WSL, especially if you use UbuntuOS.
          But for Windows users it can be convenient, for example using WSL you can run your program on Valgrind, which originally is not available for Windows.

          • yuanhonglong says:

            You are right, a person who use both UbuntuOS and Windows didn’t need a WSL or virtual machine. I am wasting my time.

            I am just curious about WSL.
            And finally find nothing useful for me. =_=!

            Thank you.

  6. Luca says:

    Does this WSL toolchain support access to a remote server? i.e. in remote credentials provide a username and ip address of a separate machine running an ssh server? This would allow me to develop on Windows but build on a remote linux server.

    • Anastasia Kazakova says:

      For now it’s implemented for WSL case only (one machine with Windows 10 and WSL set). But later this year we plan to implement a full remote access feature.

  7. Alireza Naghizadeh says:

    Hi, can you please also add the swift support for this method? In this way we can easily use swift on windows, right now only c and c++ works.

  8. sancelot says:

    I am not interested in using WSL, but using ssh connection to compile using a remote system.
    unfortunately this does not seem being possible ????


    • Anastasia Kazakova says:

      It’s possible now only with WSL. But we hope to have proper remote compile support this year.

  9. Alex. says:

    Tell me please, if I need to copy it to the address /usr/sbin after compiling the project, how can this be done? Copy there, and already from there run this project.
    Thank you.

  10. CodeDawg says:

    I am not able to create the WSL toolchain:

    I am running CLion v2018.3.2 and WSL on Windows 10.

    CLion: File>Settings>Build>Toolchains>Environment set to WSL
    Error message “Not specified” underneath an empty text box.
    Also, the dialog won’t let me manually select the WSL executable.

    Downloaded and ran the ubuntu_setup_env script. I can connect to WSL using SSH, but the error message under “Credentials” in the settings dialog reads:
    “There is no available WSL distribution”

    From the WSL terminal:
    $ lsb_release -a
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 16.04.5 LTS
    Release: 16.04
    Codename: xenial

    From the PowerShell terminal:
    wslconfig /l /all
    Windows Subsystem for Linux Distributions:
    Legacy (Default)

    I currently have a working toolchain using Cygwin.

    Any suggestions on how to get the WSL toolchain working?

    • Vasily Romanikhin says:

      “Legacy” WSL is not supported by CLion.
      Make sure that Windows version is 1709 (build 16299.15) or higher and install new WSL distribution from Windows Store (e.g. Ubuntu 16.04 LTS

      • CodeDawg says:

        Thank you Vasily. After installing a new WSL distro I was able to setup the CLion toolchain with it.

        There were some issues along the way. These were the steps I took to solve the problems:

        Installed Ubuntu 18.04 from the Windows Store and set it as “default” using wslconfig.exe. Ran the ubuntu_setup_env in the new Bash shell.

        CLion (or any other terminal) still failed to authenticate the WSLuser/password. Task manager showed that there were several ssh tasks running so I manually shut those down.

        Another attempt to ssh into WSL failed with a “man in the middle” attack warning and a suggestion to remove the host key.

        After removing the host key I was able to ssh into WSL as well as setup the CLion toolchain.

  11. Mariusz says:

    Hi there,
    Maybe it’s a stupid question, but what’s the password to the ssh port?

  12. Wiktor says:

    Is it possible to use the WSL terminal in CLion? If yes, how do I do that?

    • Vasily Romanikhin says:

      No, it’s not possible to use directly WSL terminal in CLion.
      But if you successfully setup WSL toolchain in CLion you can open remote terminal Tools -> Start SSH session (in your case it will be WSL terminal).

  13. Daniel Desery says:

    I now made it through all the steps, including the check with “ssh [user]@localhost -p2222” and this also worked.

    But CLion still can´t find the toolchain, it´s saying “not found” for the first listbox (where ubuntu.exe is configuered, which is in the right location!)

    I am using
    – Windows 10, 1709/16299.904
    – CLion 2019.1, 191.6183.77 March 25 2019

    Many thanks and cheers,

  14. tom says:

    how should I use Third-party libraries in Clion with WSL enviroment

  15. Ilia Lotosh says:

    I’m trying to configure CLion 2019.2.4 to use WSL, but I don’t have WSL listed in the Environment box (only MinGW, Cygwin and Visual Studio). What am I doing wrong?

    (I have WSL installed and I even managed to install CLion inside the WSL and open it using X-Windows)

  16. faruk says:

    I receive this error, everything seems fine on settings. I’m using Debian WSL;

    Process finished with exit code -1073741515 (0xC0000135)

  17. Bhavesh says:

    Thanks this works on debian

  18. mitien says:

    is it possible to use windows Clion to run WSL but custom sysroot and toolchain? or at least make WSL cmake alias?

Leave a Reply to vasily_romanikhin Cancel reply

Your email address will not be published. Required fields are marked *