CLion 2018.2 EAP: open project from Compilation Database


A new CLion 2018.2 EAP (build 182.2757.13) is now available! Download it from our site, use ToolBox App or get a patch-update in the IDE in case you are using the previous EAP build. No license is required and the build is free to use, but it will expire within 30 days of the build date.

Download CLion 2018.2 EAP

Open project from compilation database

In brief, the Compilation database format is now supported in CLion as a project model. You cannot build or run for now, but code insight does work for such projects.

What’s happening with CLion lately?

For many release cycles, CLion was a CMake-only IDE, meaning it did not support any non-CMake-based projects. But recently, we’ve started decoupling CMake from CLion. Beginning with CLion 2018.1, you can open any file or folder in CLion, even if no proper CMake model is provided. However, code insight in these cases is limited as the IDE doesn’t know enough about the project.

For Rust, we supported the Cargo build system via the Rust plugin in CLion. CLion 2018.2 EAP introduces support for Gradle C++ projects.

Slowly but surely we’re supporting more build systems in CLion!

What is a compilation database?

It’s a set of all compile options used to build the files in a project. A sample file looks like this:

More detailed information on compilation databases can be found here.

How to get a compilation database json file?

There is a list of build systems, compilers, and specialized tools that support the generation of compilation database files. For example, CMake generates it when set(CMAKE_EXPORT_COMPILE_COMMANDS ON) is used (for Ninja and Makefiles generators). For Clang v5.0 and later, -MJ option does the trick. For Ninja v1.2 and later, the option is called -t compdb. Tools like bear and intercept-build help generate a compilation database json by intercepting calls to the compiler during the build. There is even an extension to Visual Studio that generates the compilation database file from VS solutions. And for make-based build systems compiledb-generator is a tool to generate compilation database.

I’ve got a compilation db json file for my project. What’s next?

Select Open in CLion and point it to your compilation database json file (or the directory containing such a file):

Click ‘Open as a project’ and you are done! The status of all commands in compile_commands.json will be provided for you in CLion:

The directory containing the compilation database json file is treated as the project root by default. You can change the project root later, by going to Tools | Compilation Database  and selecting Change Project Root.

Code insight, including code completion, code navigation, refactoring and code analysis, is fully available:

Any known limitations?

The most important point is that due to the lack of the corresponding information in compilation database files, it’s not yet possible to build, run, or debug such projects. We do plan to add the ability to provide building and running commands for such projects.

Our first step will be to add an ability to Compile a single file using the compilation command from the compilation database (CPP-13059).

Other improvements

Other improvements and fixes include:

  • WSL support in CLion now works correctly with Ubuntu 18.04 (CPP-12968).
  • CLion can now launch Valgrind Memcheck for Gradle Native Application configuration (CPP-13013).

The full release notes are available here.

Your CLion Team
The Drive to Develop

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

14 Responses to CLion 2018.2 EAP: open project from Compilation Database

  1. John says:

    clion shows “private ‘AAA::AAA(int)’ is inaccessible”, but can complie successfully (gcc 7.3).


    using namespace std;

    class AAA {
    AAA(int a) {

    static void foo() {

    class BBB : public AAA {
    BBB() : AAA(22) { //private ‘AAA::AAA(int)’ is inaccessible

    cout << "aaa" << endl;

    BBB b;

    int main() {

    return 0;

  2. Иван Дмитриевич Черновалов says:

    A severe but has turned out to exist not only in EAP but in Stable build!!:
    #pragma omp for{
    When you put { right next to any word on #pragma
    The only way to use Clion then is to close it. And with other editor say notepad++ remove {

  3. Matt Hurd says:

    An infinite loop it seems. Went away and still processing an hour later… screenshot:

    Using range/v3/all.hpp via conan. introspecting ranges::for_each

  4. Matt Hurd says:

    After many minutes in an existing large project that used to take a good few seconds to get ready:

    • Anastasia Kazakova says:

      Is it possible to share the code sample, logs, or any snapshots? It’s hard to investigate by the screenshot.

Leave a Reply

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