Early Access Program News

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:

  "directory": "/Users/me/prj/Calendar/",
  "command": "/usr/local/bin/g++-7   -I/Users/me/prj/Calendar/calendars  -g   -std=c++11 -o calendar_run.dir/main.cpp.o -c /Users/me/prj/Calendar/main.cpp",
  "file": "/Users/me/prj/Calendar/main.cpp"
  "directory": "/Users/me/prj/Calendar/calendars",
  "command": "/usr/local/bin/g++-7   -I/Users/me/prj/Calendar/calendars  -g   -std=c++11 -o calendars.dir/calendar_defs.cpp.o -c /Users/me/prj/Calendar/calendars/calendar_defs.cpp",
  "file": "/Users/me/prj/Calendar/calendars/calendar_defs.cpp"

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.
More options can be found here.

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

Comments below can no longer be edited.

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

  1. Avatar

    John says:

    May 31, 2018

    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. Avatar

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

    June 1, 2018

    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 {

    • Anastasia Kazakova

      Anastasia Kazakova says:

      June 1, 2018

      I don’t see any issue with it on my side. Could you please submit a sample project to reproduce to https://youtrack.jetbrains.com/issues/CPP or clion-support at jetbrains.com?

      • Avatar

        Ivan says:

        June 3, 2018

        https://youtrack.jetbrains.com/issue/CPP-13255 I’ve recorded video The problem is not with specifix project but with parser in general… If you won’t reproduce it I’ll provide you with whatever needed….

        • Anastasia Kazakova

          Anastasia Kazakova says:

          June 3, 2018

          Thanks. We’ll take a look and update in the ticket.

  3. Avatar

    Matt Hurd says:

    June 6, 2018

    An infinite loop it seems. Went away and still processing an hour later… screenshot: https://imgur.com/a/RQTibje

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

  4. Avatar

    Matt Hurd says:

    June 6, 2018

    After many minutes in an existing large project that used to take a good few seconds to get ready: https://imgur.com/a/bZtQOb9

    • Anastasia Kazakova

      Anastasia Kazakova says:

      June 6, 2018

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

  5. Avatar

    Nikolay Pelov says:

    December 8, 2018

    I’m sure you have a reason about that, but why do you make other build systems support when Makefile is most requested. Compare requests (issue stars) for Compilation database (5) and for Gradle (125) to the requests for Makefile (about 1000). And you decide to support gradle and compilation database first? Your IDE understands C language. How hard can it be to parse a make file? Well, probably it’s a bit harder than it looks because if it was that easy you would have done it already, but still… compare how many years it took to make CLion with how many years it took (after you do it) to support Makefile.

    I’m waiting for the day when I can just open Makefile project and just work on it without work-arounds, Settings and any changes to the project. Then I’ll buy CLion. It’s so annoying that the best IDE in the world does not support the basics.

    • Anastasia Kazakova

      Anastasia Kazakova says:

      December 8, 2018

      Gradle was mostly supported for Kotlin/Native and only then for C++, and compilation database is a universal format you can generate out of every project model, so we prioritize is as an easy way to open any build system in CLion. Makefiles support is planned, but it has complicated technical issues, which we can’t resolve easily now, so postponed it for later.