Clion 2020.3

 

C语言基础不咋地, 所以得多动手, 动手又得有工具。平时用IDEA用的比较多,jetbrains这家公司的全家桶的确非常好用,所以就考虑到了Clion.安装完clion, 还需要安装Toolchiains.

  1. Clion Eap
  2. Clion Qt
  3. Clion 2020.3激活码
  4. Clion 2020.3 Activation Code
  5. Clion 2020.3 Release Notes
News
  1. A new CLion 2020.3.4 bug-fix update is now available! Build 203.8084.11 is available for download from our website, via the Toolbox App, or as a snap (for Ubuntu). A patch update will be available shortly.
  2. I have recently encountered an issue where I get loads of errors when CMake does a basic compiler check. The errors are as follows: 'C:Program FilesJetBrainsCLion 2020.3.2bincmakewinbin.
  3. CLion 2020.3 Help. Keymap: LightEdit mode. When you need to edit just one file without creating or loading the whole project in CLion, you can use the LightEdit mode. Keep in mind that the LightEdit mode works as a text-like editor, and it doesn't support the usual IDE editor features such as code completion, or code navigation.

CLion has just been given a massive update from 2020.2, with Makefile project support, more C++20 features supported, new code analysis checks, Doctest framework integration, and much more. We have even more planned for the next release. Let’s take a look at what we have in store for the fall.

Special thanks

Before we move on to our plans for 2020.3, let’s follow our tradition of thanking everyone who has helped us identify various issues, usability glitches, and missing features during the Early Access Program. Thank you all! Without your contributions we would have never been able to have such a great release. Additionally, this time, we’d like to thank some people who have helped us particularly with testing and sharing detailed feedback on the new Makefile project support. All your help was very much appreciated! As a special thanks to some of the most active evaluators, we’d like to present them with a complimentary 1-year CLion subscription:

  • Adam Ierymenko
  • Jakub Czekański
  • Julian Schneider
  • Pavel Kunyavskiy
  • Devendra Deshpande
  • Charis Marangos

Clion Eap

We’ll email you your coupon code in the next few days. If you’d like to pass this code on to a friend or colleague, that’s OK, too!

Roadmap: CLion 2020.3

Our main priorities for 2020 remain unchanged, and we are continuing to move in the direction we have set for CLion. Let’s have a look at what in particular we’re going to be working on in the near future to get us there.

Please note that the following is only a preliminary plan. We cannot guarantee that all of the features listed below will be included in CLion 2020.3.
  1. Performance
    As IDE performance is our top priority, we’ll continue eliminating freezes and the issues around refactoring the code causing high CPU and memory usages. We are also planning to fix the UI freezes on Copy/Paste caused by autoformatting (CPP-17439).
  2. C++ language support
    Apart from the regular bug fixing and tuning our Clangd-based engine even further, we are planning to start work on a few language specific features that might not be ready for the 2020.3 release. However, work on them will begin in this release cycle:
    • Qt-specific features are being considered, like project templates (CPP-8321), CMake live templates (CPP-14724), and some specific handling for Qt code constructs (CPP-1897).
    • We have plans for an initial set of MISRA checks.
  3. Project models
    We’ll mostly focus on improving our recently released Makefile project support, fixing various issues and usability problems. We are also planning to make a few enhancements:
    • Add an action to automatically create Makefile Run/Debug configurations.
    • Improve our current make command output parsing analyzer by adding support for libtool and dolt (CPP-19549). This will help CLion load Makefile projects such as curl, bitcoin, lbrycrd, PHP, VLC, and many others.
    • Support pre-configuration steps before loading Makefile projects in CLion (CPP-16924).
  4. Unit testing
    • CTest support is planned (CPP-905).
  5. Debugger
    A few useful improvements are planned. Some are even under development already, but we didn’t manage to get them done in time for the 2020.2 release:
    • Ability to debug as root (CPP-7224).
    • Ability to disassemble on demand (CPP-9091).
  6. Remote mode
    While reloading remote project performance is our top priority here, we are also planning to start work on native Docker support in CLion (CPP-13751). We hope there will be some initial results to present in the 2020.3 EAP.
  7. Embedded development
    In regards to embedded development functionality, the next release cycle will be mostly about fixing issues and maintenance, so feel free to report any issues you come across to us!

That’s it! If you have any new feature requests, please send them to our issue tracker. We’re listening!

Your CLion team
JetBrains
The Drive to Develop

How-To'sTips & Tricks

With CMake 3.15 it has become possible to use the Clang compiler on Windows with a GNU-style command line. This also means that it’s possible to use Clang with the Mingw-w64 toolchain.

While it’s possible to configure Clang with the Mingw-w64 (or MinGW) toolchain, if you decide to use Clang from the LLVM repo, it won’t work correctly. This is because LLVM Clang for Windows is built using Microsoft Visual Studio, and all the built-in macros and include search paths are set up for use with Visual Studio. So even when used with the MinGW toolchain, it will still try to include MSVC standard library headers.

We’ve done some experiments and found a possible workflow that involves using CLion in combination with the MinGW toolchain and Clang compiler.

Here are our findings:

  1. Install MSYS2 from https://www.msys2.org, follow their installation guide.
  2. Get the necessary packages with the pacman tool. We installed the following (pacman -S):
    • mingw-w64-x86_64-gcc
    • mingw-w64-x86_64-clang
    • mingw-w64-x86_64-lld
    • mingw-w64-x86_64-gdb
    • mingw-w64-x86_64-make
    • mingw-w64-x86_64-polly
    • mingw-w64-x86_64-compiler-rt

This clang compiler is built with mingw-w64 and has paths and macros that correspond to this toolchain.

Now we are ready to set up the CLion toolchain. Go to Settings/Preferences Build, Execution, Deployment Toolchains:

With your new toolchain configured, you can start building your project. You can use either the default ld linker or set the lld with -DCMAKE_LINKER=lld.

Using advanced tools provided by the Clang compiler

Clion Qt

In theory, all Clang tools should also work without any issues. However, problems can arise involving compiler-rt. compiler-rt is a set of runtime libraries which are required to use sanitizers and profiling in Clang, the current compiler_rt package was built with MinGW. But Clang requires a compiler that is built with Clang and lld.

Clion 2020.3

In our case, we wanted to use profile-guided optimization. One of the options for making this work is to get the compiler-rt source code of exactly the same version as the Clang version in MSYS2. This can be challenging, so the other solution is to clone the LLVM monorepo and build the tools you need.

For -fprofile-instr-generate it might be enough to build only compiler-rt and llvm-profdata to merge the profiler results. However, to use all the tools reliably, it’s better to build Clang and lld, as well.

Luckily we already have the required setup for that build.

Clion 2020.3激活码

The last step is to replace the binaries in <msys2_path>mingw64libclang<clang_version>libwindows with libraries from <compiler-rt_path>cmake-build-release-mingw_clanglibwindows or from <llvm_build_path>libclang<clang_version>libwindows in case of monorepo.

Clion 2020.3 Activation Code

Using Clang for profiling

Clion 2020.3 Release Notes

With the compiler-rt libraries in place, it’s now possible to use the same toolchain we set up with -fprofile-instr-generate/-fprofile-instr-use flags. Let’s build LLVM for this experiment, since we already have the source code. We’ll also use -DLLVM_ENABLE_LTO=Thin for even more optimization. Go to Settings/Preferences Build, Execution, Deployment CMake:

With this CMake configuration, you can build the Clang compiler and use it, for example, to build your own project. This will generate the relevant profiler information, which should later be merged with the tool we built earlier – llvm-profdata. With the merged profile_merged.profdata file, you can finally build the optimized version of the Clang compiler:

Using custom Clang and lld

Getting the gcc-style -fprofile-generate/-fprofile-use flags to work correctly requires changing the Clang path and setting -DCMAKE_LINKER to the newly built lld. You also need a few additional tricks for LLVM : -femulated-tls and linking pthread.

Then you should repeat all the steps you performed with -fprofile-instr-generate/-fprofile-instr-use.

Conclusion

Using Clang on Windows is now possible and does not require you to have Microsoft Visual Studio installed!

We hope that in the near future, using advanced clang tools will become easier and will no longer require the manual build. Let us know if you discover any other ways to achieve the same results!

Your CLion team
JetBrains
The Drive to Develop