CLion 2018.1 is released: more C++17, WSL, CMake Install, new languages supported, and much more!

Please welcome the first big update this year, CLion 2018.1! It’s packed with various enhancements and cool new features for C/C++ developers on all platforms, and especially on Windows, plus a range of benefits for those who use C/C++, Objective-C / Objective-C++, Rust, and Fortran.

800x400_blog_CL_2018_1_@2x_

Read on for more details and get your free 30-day trial to evaluate all the new features and enhancements:

For a quick overview of the new features and enhancements, watch this video from Phil Nash:

Download CLion 2018.1

C++ support: more C++17

We’ve been focusing on C++ a lot. We’re working in several directions that may lead to better language support in the long run, including both accuracy and performance. We’re considering some alternatives to the current language engine in CLion, and have already run some experiments (expect some results in 2018.x versions). Nonetheless, the current implementation is still our main area of focus, and v2018.1 offers some major improvements like:

  • Support for C++17 structured bindings
  • Support for C++17 if and switch with initializers
  • Proper support for ternary operator
  • Reliable refactorings (Rename and Change Signature) for hierarchies:
    Rename siblings

Besides, the editor is now more responsive thanks to incremental highlighting and principal changes to typing handlers.

Clang-Tidy: more flexibility, more control

Clang-Tidy is a powerful tool which complements CLion’s own code analyzer. In this release, we’ve given it more control.

First, you can now provide options required for some checks like modernize-use-nullptr. Second, you can ask CLion to use .clang-tidy config files instead of the IDE-provided settings. This means your whole team can use the same Clang-Tidy’s set of check, regardless of the variety of IDEs and text editors that different team member are using. To do all this, go to Settings/Preferences | Editor | Inspections | C/C++ | General | Clang-Tidy:
Clang_Tidy

We’ve also updated the bundled version of Clang-Tidy and optimized the set of checks turned on by default.

WSL: Linux binaries on Windows

In this release, support for Microsoft Visual C++ Compiler is turned on by default (no need to turn it on in the Registry now), so you can use it easily if you have it installed on your machine. We’ve also expanded the number of toolchains supported on Windows by adding WSL support.

WSL makes it possible to compile, run, and debug Linux binaries while working on your Windows 10 machine. Multiple Linux distributions are supported, so you can pick your preferred one. Simply start WSL on your Windows machine and connect to the toolchain from CLion. CLion will use CMake, make, GCC/G++ compilers and debugger from WSL, and will build and run your binary there.
WSL_toolchain_settings

Besides, WSL toolchain support comes with Valgrind Memcheck, which is now available to Windows users in this way:
WSL_Valgrind_set

To learn how to install WSL and configure it for CLion, please refer to this blog post.

WSL is a first step to full remote support in CLion, which is why it was implemented via SSH. You can expect further remote development features in the upcoming 2018.x releases.

CMake: Install & non-CMake projects

As promised, we’ve started the process of decoupling CMake project model from CLion. The first results are already here – you can now open a single file or folder (w/o CMake) in CLion. CLion still requires a CMake project to provide smart IDE features, but in case you just want to read some C++ code in CLion, it should be enough.

We’ve also continued to work on CMake integration in CLion, and are happy to introduce the CMake Install action in the editor. Use it from the Run menu, or add an Install step to any of your run configurations in CLion:
cmake_install

And finally, ‘Create new file’ (Alt+Insert) now gives you an option to create a CMakeLists.txt file. The content of the generated file is defined by the template in Settings/Preferences | Editor | File and Code Templates, so you can customize it based on your project’s or team’s needs.

Editor: more actions, better navigation & project scopes

We use CLion to code in C++ on our own, some of the time, and this helps us implement some tiny but nice additions to the editor. We find them useful and we hope you’ll like them too:

  • Breadcrumbs for C/C++: These small markers at the bottom of the editor help you navigate around your code. Showing namespaces, classes, structures, functions, and lambdas, they make reading and navigating through the code much easier:
    breadcrumbs
  • Unwrap/remove code blocks: This is yet another IntelliJ Platform feature that has been implemented for C/C++. It safely unwraps if, else, for, while, do..while and for control statements, or just accurately removes enclosing parts of nested statements:
    Unwrap
  • Code folding of the control statement: This was one of the top-voted requests from our users. Use Shift+Ctrl+Period / Ctrl+= (on Windows/Linux) or ⇧⌘./⌘+ (on macOS) to collapse/expand control statements (like if/else, do/while, for, or switch) with a multiline code block, or with a code block inside braces.
  • Message toolwindow settings: These extra settings allow you to configure if build output is always necessary (and thus should be visible) or only needed if some warnings or errors appear.

Another thing worth mentioning here is Project Scopes. With many predefined scopes (Project Source Files, Project Non-Source Files, and Changed files) and an ability to create custom scopes, you get a chance to look at the project at different angles in Project View, and filter results easily in Find in Path.

VCS: partial Git commits

Partial Git commits (git add -p) are helpful when you want to commit some particular changes in your project to the version control system while leaving other changes for later. CLion now supports this in the UI. While committing changes, select which code chunks to commit and tick them off in the Diff pane of the Commit Changes dialog. You can also move changes between changelists right from the editor, using change markers in the left gutter. Learn more in the IntelliJ IDEA blog.
add_to_changelist

Beyond C++: Rust, Fortran, Objective-C/C++

CLion 2018.1 comes with bundled support for Objective-C and Objective-C++. Check out exactly what is supported.

Besides, plugins for Rust and Fortran are available and have been updated. Rust comes with Cargo build system support (thanks to decoupling CMake from CLion!) and the debugger. Fortran works via CMake and supports FORTRAN 77, Fortran 90, Fortran 95, Fortran 2003, and Fortran 2008 source code. Read more about these plugins in this blog post.

Sound impressive yet? Explore all the new features in even more detail on our website. Start your 30-day free evaluation and try out all these new features and fixes!

Download CLion 2018.1

Your CLion Team

JetBrains
The Drive to Develop

This entry was posted in Announcement and tagged , , , , , , , . Bookmark the permalink.

59 Responses to CLion 2018.1 is released: more C++17, WSL, CMake Install, new languages supported, and much more!

  1. Jhonny says:

    The Kotlin/Native Plugin can’t be activated.

    • Anastasia Kazakova says:

      Which error do you get?

      • Jhonny says:

        I fixed it. It requested the “Markdown support” plugin to be enabled and after enabling that and disabling the “Kotlin” plugin it worked.
        Sadly I still get the following error on Windows:
        CMake Error at KotlinCMakeModule/CMakeKotlinInformation.cmake:144 (message):
        Unsupported host target

        When can we expect Windows to get supported?

        • Anastasia Kazakova says:

          Kotlin/Native on its own works fine on Windows. However, we consider it unsupported because possible issues in CMake. Still you can try to remove Windows limitations in CMake and proceed updating CMake it until it works.

  2. Anton Rapetov says:

    Hi, thanks for new features, but is there any progress on those issues:
    1. https://youtrack.jetbrains.com/issue/CPP-12180
    2. https://youtrack.jetbrains.com/issue/CPP-12181

    One of them is the regression one introduced in 2018.1. I thought that the point of EAP program – catch and fix regression issues before releases…

    • Anastasia Kazakova says:

      We are sorry for that. However, it’s not always possible to fix all the regressions during the EAP program. Sometimes some deeper issues are identified and so we have to postpone it (maybe even the problem existed before but didn’t show up before some changes). Anyway, we’ll take a look at this and will do your best to fix for some 2018.1.x update.

      Regarding the first one – we’ll check if we can fix it quickly.

  3. Denys says:

    Okay. Now I need a simple explanation: should I use IntelliJ w/ Rust plugin or use CLion w/ Rust support?

    I have the IntelliJ Ultimate Edition and CLion, but this news now makes me wonder which one should I use to develop in Rust.
    I mean, technically Rust is more similar to C than Java – therefore as a separation of concerns CLion may be the most suitablr choice.

    But… what really counts are the features: is the CLion Rust integration identical to IntelliJ + Rust plugin?
    Why should I use the first / the latter as my Rust IDE instead of the latter / the first?

  4. Alexander says:

    Pleeeease! Your parser must be best of the best! But you released 2018.1 with this bug https://youtrack.jetbrains.com/issue/CPP-12275 and many similar bugs! My team very sad!

  5. Arthur says:

    Hello,

    Jetbrains Toolbox proposes to upgrade Clion to 2018.1 but after the installation is complete the folder 181.4203.549 contains the previous release (173.X) instead.

    I’ve already encountered several times this issue with Toolbox in the past

  6. AZ says:

    Hi!
    How can I participate in the EAP? Is it still available?

  7. Denis Marinov says:

    Clion 2018.1 is finally out. Great work! Though, why is more than 80% yet unsupported in C++17 (https://www.jetbrains.com/help/clion/cpp_support.html)? Will the rest be included in 2018.2? Thank you!

  8. Denis Marinov says:

    Thank you! Hope u can add the rest before the end of this year. I don’t wanna go back to the heavy VS.

  9. Jan says:

    Thanks for this release!

    Printing of unordered_map and unordered_set in the debugger has been broken for a while. Can this be fixed in the next release?

    This is the issue: https://youtrack.jetbrains.com/issue/CPP-10235

  10. Adam says:

    Congrats on the new release. I’ve been using it and noticed an issue resolving references on forward-defined classes that are then put in templates, for example in a header file:

    class SomeClass;
    typedef Poco::SharedPtr SomeClassPtr

    When a source file has an instance of SomeClassPtr making a function call, that function call shows up as unresolved. When I control-click on SomeClassPtr, it takes me to the forward definition, not the real definition, I suspect it’s trying to resolve off the forward declaration. This was not an issue in 2017.3. This pattern shows up a lot in our code.

    Thanks!

    • Anastasia Kazakova says:

      Could you please share the full sample to reproduce with clion-support @ jetbrains.com or here? Thanks in advance.

      • Adam says:

        Sure, it turns out the issue seems to happen only when a forward declaration is followed by the real declaration in the same header file. If they are in separate files the problem doesn’t happen.

        In the header file, put:
        #include
        class SomeClass;
        typedef std::shared_ptr SomeClassPtr;
        class SomeClass
        {
        public: void someFunction() {}

        };

        in the source file:

        int main()
        {
        SomeClassPtr p(new SomeClass);
        p->someFunction();

        }

        someFunction() will not resolve in the source file. Thanks!

        • Adam says:

          Looks like some brackets got removed in the above post.

          The #include had “memory” in brackets, the shared_ptr had “SomeClass” in brackets.

      • Adam says:

        Anastasia, I filed issue CPP-12552 on this, included example files. Thanks.

  11. Tano says:

    Hi Anastasia, any news about IDEA-187808?
    It’s a bit strange that you released 2018.1 without it, it;s really annoying.

    • Anastasia Kazakova says:

      Hi,
      We have issues with reproducing. Seems now we finally got some stable scenarios, the ticket is under investigation.

    • Anastasia Kazakova says:

      All cases that we managed to reproduced was fixed, and will likely be cherry-picked to the upcoming 2018.1.1 EAP next week. When it’s available, please check and let us know. Thanks

  12. Boxin Wang says:

    Thanks for the release! Really love this smart IDE!

    Btw, I have a problem about non-project files. It seems in this version, non-project files will not be grayed out like it used to be. Instead, the project files will have a small blue square indicator while non-project files won’t.

    My question is could I have some options in preferences to enable the old styles when treating those non-project files? Thanks for your reply~

    • Anastasia Kazakova says:

      You are right, we’ve changed the visual indicators, and were not planning to enable old style highlighting.

  13. Tano says:

    I have some problems with this version, meaning that in one specific file sometimes I cannot press enter or backspace key. Only CLion restart fixes this problem.
    How should I proceed in this matter?

    • Anastasia Kazakova says:

      What does “cannot press” mean? Is there any UI freeze on this file?

      • Tano says:

        I am pressing enter or backspace and it does not work and the editing of the file seems to be a lot slower, but only for that file. Other keys work ok, I know that it sounds strange, i will make a small movie next time.

        I enabled profiling and I wait the problem to occur again.What would be more useful, CPU or memory snapshot?

        • Anastasia Kazakova says:

          CPU I guess. And please check if there are any thread dumps generated at the moment (in the logs directory)
          Thanks

  14. Ehtsham Elahi says:

    thanks for the release. But it seems it comes with more parsing issues. Some of them were highlighted in this: https://youtrack.jetbrains.com/issue/CPP-11338. A few more show up like sampling from a normal_distribution defined locally in a constant function is marked erroneous as calling a non-constant operator inside a constant function. Clion 2017.3 parsed all these correctly.

    • Anastasia Kazakova says:

      Unfortunately, major rework in the parse can generate some regressions. We are sorry we were not able to catch them all and fix. Will do your best to take a look in the upcoming minor updates to 2018.1

  15. ChristopherG says:

    Need a community edition. Want you to treat namespaces as folders like you do packages in java.

  16. Anton says:

    Clang-Tidy with options and .clang-tidy config support.

    “you can ask CLion to use .clang-tidy config files instead of the IDE-provided settings”

    Hi,
    Can you make the same thing for .clang-format as the way to share code style settings among team members?

    • Anastasia Kazakova says:

      Clang-format task is in our queue, but awaits for some platform changes. Hope to get it in some 2018.x

  17. Andrew Somerville says:

    Looks like the change log is missing. Can you please link it?

  18. Nasser says:

    Good morning. I’m having some problems with the WSL configuration. I followed the instructions in the blog and also checked the video in youtube but I’m still not able to set the toolchain properly.

    If I have running the Ubuntu console with the script Ubuntu_setup_env.sh, when I create the Toolchain using WSL (I have Ubuntu and debian Installed), the Path for the binary Ubuntu.exe says that it’s not found (but the other fields like Credentials Cmake …etc are green)

    If I close the Ubuntu console, then, I can see the Path showing Version Ubuntu 16.04.3 LTS but of course, because it’s not running, all the other fields are wrong. I was trying to find someone with my same problem but no luck there neither. Any idea?

  19. John says:

    The experimental hex view is such a relief to have! Looking forward to it being available by default.

    https://blog.jetbrains.com/clion/2018/03/clion-2018-1-eap-structured-bindings-breadcrumbs-hex/#hex

  20. Iliyan says:

    CLion is getting better and more reliable with each release. As a recent Windows-to-Mac convert, I don’t miss Visual Studio anymore, thanks to your amazing IDE!

    I have a silly question though. Why don’t you show control flow folding markers on the left of the editor, just like the markers for folding functions/classes? Currently the only way to fold control flow is to remember a complex shortcut. I know I can customize the shortcut, but folding is one of the few things I actually prefer to do with the mouse while editing code. It seems counter-intuitive to me that those markers only appear after the first time you fold a piece of code.

  21. Bruseli says:

    I want clion_key to learn who give me one?

  22. Piotr Dobrogost says:

    “As promised, we’ve started the process of decoupling CMake project model from CLion” – could you please provide a link to the original text?

  23. Etienne Buschong says:

    Hi. I am currently experimenting with the Wsl Toolchain in Clion and have problems with environment variables. For my program to run i need to set an environment variable. While the program compiles fine with the Toolchain, the program does not run because the variable is not set properly.
    The path to the variable points to a path in the Wsl, and it works if i specify it in the “Environment Variables” in the toolchain. Is there a way that i can specify my env-variable in Wsl and everytime in every new project in the toolchain?

    • Vasily Romanikhin says:

      Hi!
      You can specify “Environment Variables” for Application Template (Edit Run Configuraion | Templates | Application). In that case all new run configurations have to inherit template “Environment Vars”.
      Please note there is no way to specify Env Variables only for WSL.
      I suppose you can specify WSL specific env-vars directly in “.bashrc” file.

Leave a Reply

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