Quantcast
Channel: CLion : A Cross-Platform IDE for C and C++ | The JetBrains Blog
Viewing all 681 articles
Browse latest View live

CLion 2018.2 EAP automatically treats included files as project files

$
0
0

Hi,

A new CLion 2018.2 EAP (build 182.3341.14) is now available! Download a fresh build from our site, or get it via a patch-update (will be available shortly in case you are using the previous EAP build). You can also update via Toolbox app or snap packages (in case of Ubuntu).

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

CLion provides a full code insight (including the project-wide code analysis, a plenty of refactorings, an instant navigation) inside the project files, whereas non-project files are served with limited code insight. For a long time, from the v1.0 files not listed directly in the CMake files were not considered as project files. This caused some inconveniences as, for example, header files are rarely included this way, and in many cases it’s not required for successfully building the project.

Now, if you include the header or source file into any project file, CLion will automatically treat it as a project file as well, which means full code insight will work in there!

auto_include

Note, there are still some cases where this doesn’t help like CPP-11340 and CPP-13351.

Full release notes are available by the link.

Your CLion Team
JetBrains
The Drive to Develop


CLion 2018.2 EAP: clangd as an additional C++ language engine

$
0
0

Hi,

A new CLion 2018.2 EAP (build 182.3458.13) is now available! As usual, a patch-update will be available shortly for those using the previous EAP build, and you can also use Toolbox app or snap packages (in the case of Ubuntu) to get this 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

In brief, in this build clangd is available as an additional C++ language engine in CLion. It’s turned on by default on Linux and macOS and is used for showing code errors and warnings in the CLion editor. This feature is experimental, which means we can not guarantee it will make it to the official CLion 2018.2 release.

And now let’s talk about it in details.

Intro

CLion provides rich code insight abilities for C and C++ code. All these refactorings, code completion, code generation, code analysis, and other features are working on the language engine which CLion provides. We constantly work on making the language support in CLion more accurate and knowledgeable about modern C++ language features. As part of this goal, we now would like to give clangd, a popular Clang-based language engine, a try as an additional C++ language engine.

Two is better than one

llvm Nowadays Clang is definitely the most accurate solution in terms of correct C++ code parsing and resolve. However in its current state it can’t support all the code insight features we’d like to provide in CLion. So we’ve decided to keep both language engines working at the same time.

How my IDE is affected?

Let’s talk about how the change affects CLion:

  • When enabled, clangd is used to show code errors and warnings in the CLion editor. CLion’s own code errors are turned off in this case (some warnings are still there).
  • Default configuration includes many compiler warnings, unless you turned them off manually in settings.
  • Quick-fixes are provided by the CLion’s own engine.
  • The rest of the code insight features are not affected (i.e. code highlighting, refactorings, completion, navigation is still working on top of the CLion’s own language engine).

Available settings

Clangd settings are available in Settings/Preferences | Languages & Frameworks | C/C++ | Clangd:
clangd_settings
Here you can turn on/off the clangd as errors/warnings provider and configure the Clang warnings set.

Known issues and limitations

Here is the list of the issues and current limitations known to us. If you notice anything else disturbing you, please report to our issue tracker.

  • Currently clangd is turned off by default on Windows due to a known issue on this platform (CPP-13502).
  • In some cases the quick-fixes might be provided by CLion with a noticable delay after the error shown by clangd.
  • Code | Inspect Code… action uses CLion C++ language engine. So the result may be different from what you see in the editor (as it works via clangd).
  • Complete Statement for incomplete code doesn’t work in most cases when errors from clangd are enabled (CPP-13412).
  • Some other issues: CPP-13312, CPP-13482, CPP-13484.

Full release notes are available by the link.

Your CLion Team
JetBrains
The Drive to Develop

CLion 2018.2 EAP: argument selection defects inspection

$
0
0

Hi,

Please welcome CLion 2018.2 EAP (build 182.3569.10)!

As usual, a patch-update will be available shortly for those using the previous EAP build, and you can also use Toolbox app or snap packages (in the case of Ubuntu) to get this 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

New inspection: argument selection defects

With this new inspection CLion can detect situations when wrong arguments are passed to a function call (for example, the wrong order of the arguments of the same type). The algorithm relies on various heuristics and some description can be found here. If argument and parameter names are meaningful, the results can be really impressive and useful:
arguments_swap

The inspection settings are located in Settings/Preferences | Editor | Inspections | C/C++ | General | Argument selection defects:
arguments_settings

Other changes

Besides, this build brings the following improvements:

  • It fixes the issue with failing build with WSL due to whitespace in path.
  • It bundles CMake v3.12.
  • If the compilation database for the project you try to open in CLion includes some incorrect compile command, CLion now reports a corresponding error.

It’s also worth mentioning that previous EAP build enabled clangd as an additional C++ language engine in the experimental mode and your feedback and issue reports are very important at this stage.

Full release notes are available by the link.

Your CLion Team
JetBrains
The Drive to Develop

CLion 2018.2 Release Candidate

$
0
0

Hi,

Please welcome the first Release Candidate for the upcoming CLion 2018.2!

Get the build (182.3684.12) from our website or use Toolbox app or snap packages (in the case of Ubuntu) to update. A patch-update will be available shortly for those 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 RC

Here are the highlights:

  • An experimental complementary Clangd-based language engine is now enabled on Windows by default (previously it was done on macOS and Linux). Check more details about available settings and known limitations in this blog post.
  • Fixes for GDB:
    • Debugger pretty-printers are now used when displaying pointers to structures in CLion (CPP-7276).
    • Passing of the program arguments containing non-trivial escaping on Windows is now fixed (CPP-13272).
  • Fixes for LLDB:
    • Values of the unordered_map are now displayed correctly in CLion (CPP-4845).
    • Unsigned char (uint8_t) is no longer treated as signed (CPP-13174).

Full release notes are available by the link.

Your CLion Team
JetBrains
The Drive to Develop

CLion 2018.2 Release Candidate 2

$
0
0

Hi,

Welcome the 2nd release candidate (build 182.3684.46) for CLion 2018.2!

As we are getting closer and closer to the official release, we are now mostly working on the final fixes and improvements. If you notice any problem at all, please report it to our tracker.

Download CLion 2018.2 RC2

Please note that to use CLion 2018.2 RC2 you need to have an active subscription (or start a 30-day evaluation period).

This build highlights include:

  • An experimental Clangd-based language engine got several improvements:
    • On Windows: incorrect errors on LLVM project were removed (CPP-13502) and some false errors in case of OpenMP usage were fixed (CPP-13626).
    • Invalid code ranges in case of Tab character used in the file were fixed (CPP-13631).
    • A regression was fixed: non-existing C functions in C files are highlighted, allowing create from usage fix.
  • Default C++ standard used when creating a new project in CLion is now C++14 (it was C++11 before).

Full release notes can be found here.

Your CLion Team
The Drive to Develop

CLion 2018.2 Release Candidate 3

$
0
0

Hi,

A new CLion 2018.2 Release Candidate is now available (build 182.3684.76)!

Please note that to use CLion 2018.2 RC3 you need to have an active subscription (or start a 30-day evaluation period).

Download CLion 2018.2 RC3

Our Early Access Program lets development community closely participate in discussions devoted to our products and identify issues that were possibly overlooked by our team. Unfortunately, one of such issues – CPP-13704 – is related to the new experimental clangd-based language engine on Windows. Since we can’t provide a reliable solution quickly, we decided to turn clangd-based language engine off by default on Windows. You still can enable it in Settings/Preferences | Languages & Frameworks | C/C++ | Clangd, but in this case mind the bug.

This has an unfortunate consequence – argument selection defects inspection was implemented on top of clangd-based language engine (this solves a performance issue and some others). That means that on Windows the inspection is not available unless you turn on the clangd in CLion’s settings.

Full release notes are here.

Your CLion Team
The Drive to Develop

CLion 2018.2 released: clangd, Gradle and compilation database projects, Google Sanitizers, and database support

$
0
0

Since CLion 1.0 first came out in April 2015, it has been growing steadily. Still, there are many areas for improvement, and we feel a responsibility – both to our current customers and those still waiting for some critical functionality to be added before they adopt CLion – to make progress in these areas. Hopefully, this release moves us one step closer to making good on that promise.

In this release, we’ve done our best to deliver some very important new capabilities for both groups. On the one hand, CLion comes with an experimental complementary clangd-base language engine and a set of important performance improvements. On the other, it introduces support for several new project models, which may open the door to a public project model API in the future.

800x400_blog@2x

Read on for more details (or don’t), but make sure to grab 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.2

C++ language support

Clangd as an experimental complementary C++ language engine

CLion now uses a clangd-based language engine in addition to its own language engine. This new experimental engine is turned on by default on Linux and macOS platforms in v2018.2. On Windows you can turn it on manually to try, however mind there is an issue that we are gonna address in the upcoming updates – CPP-13704. Note it’s used only to show errors and warnings in the editor, while the rest of code insight features (i.e. quick-fixes, refactorings, completion, navigation, etc.) are not affected. Read our recent blog post for more details.

If you want to turn this engine off or customize which warnings and errors it detects, go to Settings/Preferences | Languages & Frameworks | C/C++ | Clangd:
clangd_settings

What’s next? Good question! We’ll proceed with this complementary language engine to see if the combination works to ensure more accurate and quick code insight in CLion. We’ll also consider moving other code insight features to the clangd-based engine where possible, but can’t promise anything for sure at this stage. That’s why it’s called experimental for now. We’ll keep working on our own language engine too in the meantime. Stay tuned!

C++ support fixes and new inspection

A new inspection is now available to detect situations when the arguments of the same type are passed in the wrong order. This requires the parameter names to be meaningful, and the algorithm relies on several heuristics. Isn’t it great to catch this annoying error even before compiling your code?
wrong_arguments_inspection
Note, the inspection requires the clangd-based experimental language engine to be enabled.

We’ve kept advancing CLion’s own language engine, which is the basis for all smart IDE actions like code navigation, refactorings, code generation, and more. A set of enhancements for various cases have been implemented.

IDE performance improvements

We keep reworking critical components step by step to boost the IDE’s performance. And our focus is now on eliminating UI freezes. Version 2018.2 addresses a range of issues in this area. The most noticeable ones are related to the UI freezing after a VCS update, navigating to the related symbol (and thus switching between .h and .cpp files), UE4 projects freezing, and others.

The biggest improvement is probably our lexer-only indentation processor. Running the formatter on a lexer is obviously faster than doing a full parse and resolve of C++ code. We believe this change will improve the editor performance for many of our users. However, inaccuracies are possible in some tricky cases, so if you run into any issues, check here on how to switch back to the previous solution.

We’d like to remind you that if you experience an IDE freeze or a high CPU/memory usage, the IDE logs, thread dumps and CPU/memory snapshots are required to investigate the issue (here’s how to retrieve them). We would also greatly appreciate it if you collected them on the latest available CLion version.

Project models

Gradle and compilation database

This release makes CLion available for those who don’t have a CMake project, but would like to use the IDE for C/C++ development and take advantage of its full code insight capabilities.

Previously, you could only open a non-CMake folder in CLion and get limited IDE functionality for such projects. (Though to be fair, we should mention that a third-party plugin for Bazel has been available for quite some time.)

Now you have two additional options – new Gradle C++ projects and compilation database. Both provide full code insight in CLion, though with a compilation database you currently cannot build or run the project (as the model simply lacks the information this requires).

To open the project:

  • For Gradle: open the build.gradle file from the project sources (note that CLion currently support only new Gradle C++ plugins; the old style won’t work).
  • For compilation database: use the compile_commands.json file (see this list of ways to get a compilation database for your project).

CLion will show you the status of the project loading in a Build tool window:
gradle_build

And there you have it! CLion’s code insight, including code completion, code navigation, refactoring, and code analysis, is now fully available for your Gradle or compilation database project. By the way, this means that for example Makefiles and Ninja projects can now be opened in CLion – just generate a compilation database for them and go!

CMake support

As CMake remains the project model that’s most deeply integrated into CLion, we’ve given it a few helpful enhancements. The most important change is that as of today, you no longer need to list header files directly in CMake to get full code insight for such files in CLion. If you include the header or source file into any project file, the IDE will automatically treat it as a project file as well, which means full code insight will work in there!

Note: this works only if the header and source files you include are located under the project root (to avoid changes to your libraries and files when refactoring and so on).
cmake_project

Besides, now when you configure your external tools in CLion, you can use CMake-specific macros to get CMake-specific values like executable name, generation folder, etc.

New tools

We added Valgrind Memcheck support back in v2017.3 as a first step towards tools for dynamic analysis in CLion. In v2018.2, it’s now possible to export/import Valgrind Memcheck results in CLion.

This release also introduces support for Google Sanitizers. Unlike Valgrind, sanitizers require project recompilation with the -fsanitize build flag, so you have to provide it manually in your CMake script, for example: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread -fPIE -pie -g"). For Clang >= 3.8.0 and GCC >= 5.0.0, CLion then detects the sanitizer flag automatically and visualizes the sanitizers output on the “Sanitizer” tab in the run tool window:
sanitizers

See the list of supported sanitizers and the available settings in our blog post.

We’ve run a short survey on Twitter recently, asking developers if they often work with Databases when developing their C/C++ projects. It seems the answer is yes, they do! Therefore, another set of added tools that are worth mentioning are database tools and SQL support. These capabilities join CLion 2018.2 as a bundled plugin, which adds DataGrip’s functionality to the IDE. The list of supported databases is quite impressive and includes MySQL, PostgreSQL, Oracle, DB2, Sybase, and others. In addition to various options to browse and modify database content, the plugin also provide full code insight for SQL.

Debugger

CLion 2018.2 comes with bundled LLDB v6.0 on macOS and Linux. It provides GDB v8.1 on Linux and Windows and GDB v8.0.1 on macOS.

Integration with GDB has been improved on all platforms and now CLion uses pretty-printers of a type to display pointers of that type:
gdb_debug_view

As for LLDB, CLion now treats unsigned char correctly in the debugger, and correctly displays unordered_map:
lldb_fixes

Recompile a single file

A small but neat feature was added to speed up your development cycles in CLion when working with CMake or compilation database projects. Now you can recompile a single file without triggering the full project recompilation. This is really handy for checking local files changes:
recompile

Learn how it works in detail by reading this blog post.

And more

There are more changes in this release than can fit into this blog post that’s already long enough (if you’re still reading this – thanks!). At the very least we must mention the latest IntelliJ Platform goodies, including MacBook Touch Bar support and a few VCS support enhancements.

Try these new features by downloading CLion 2018.2 and starting your 30-day free evaluation. By the way, you can use this demo project from GitHub to check out some of the enhancements. Do give us your feedback, too!

Download CLion 2018.2

Your CLion Team

JetBrains
The Drive to Develop

Rust plugin update: language support improvements, new quick-fixes, improved debugger and more

$
0
0

Hi,

CLion 2018.2 was released just recently. Along with the release, the Rust plugin has had an update! In this blog post, we’d like to highlight some of the main improvements in the plugin.

However, before we do that, let me briefly remind you about the current state of the Rust plugin:

  • It’s available in all our IntelliJ-based IDEs.
  • It relies on the Cargo build system, and CLion is no exception here!
  • The debugging feature for Rust code is currently only available in CLion.

Here we listed earlier the features in the Rust plugin. What’s new for Rust with the 2018.2 update?

Language support

There is a set of language support improvements. We’ll highlight the most important:

  • Pattern-matching on references got some attention in the language (RFC 2005), and now it is supported properly in the IntelliJ Rust plugin, which means the types are inferred correctly.
  • The expansion of declarative macros guarantees that you can now get better code insight when using macros. For example, the completion works:
    Macro Expansion
    The best use of it is for error handling via error-chain crate based on macros.

    Keep in mind its limitations – if the impl block is generated with the macro on its own, then such completion won’t work as the IDE currently is not aware of its expansion.

New and improved quick-fixes

A whole new set of quick-fixes were implemented to make your Rust code more accurate and save you time while coding. The first group of quick-fixes is related to the type-check errors. For example, when a manual cast is missing in the code (as an implicit cast is not allowed for primitive types) you can generate a proper cast with Alt+Enter: Numeric type cast

As CLion (and the other IntelliJ-based IDEs with the Rust plugin) is aware of the traits available for the type, it can suggest type conversions to fix type checking errors in the code using the proper trait. An example of how this could be used is if a string was used by mistake, but the FromStr trait is present for the type, then a quick-fix invoked with Alt+Enter can generate a proper conversion:
String trait usage

By the way, while we are on the topic of strings, as you know String and &str are not the same in Rust. The main difference is in the object ownership – &str is just a reference to some location in the memory, it doesn’t own it. So what if a &str is passed where the String is needed? There are several options actually, and all of them are available in the quick-fix menu:
String convertion

You can also convert a struct to reference to this struct where needed:
Reference quick-fix

There are even more quick-fixes available for the type checks, thanks to oleg-semenov’s incredible contribution to the IntelliJ Rust plugin!

As for the other code analysis checks, an unresolved reference check with the Auto Import quick-fix can save you time if you have tried to start using something before importing it:
Unresolved reference

Besides, when you implement missing members via a quick-fix, the IntelliJ Rust plugin will correctly substitute a generic type parameter and lifetimes for you! How cool is that?Implement missing members

Quick documentation update

Quick Documentation (Ctrl+Q on Linux/Windows, F1/^J on macOS) shows the documentation for the symbol at the caret. And now it includes the links to https://doc.rust-lang.org/std/ for the standard library items:
Quick Documentation

Pretty-printers in debugger

CLion comes with the Rust debugger included. You know that! And now it loads the default Rust pretty-printers for you, so that you now have a nice view of the values of the default types like strings or vectors.

Better project view

The Cargo tool window (View | Toolwindows | Cargo) now shows all the workspace members and targets:
Cargo toolwindow
It simplifies the way to run targets – you can now simply click on them in this tool window. You can also refresh your Cargo project, run clippy or a Cargo command, and attach or detach a Cargo project to the workspace.

There are some important enhancements to the editor’s performance, so that the typing in Rust feels smoother and the editor is more responsive. And there is even more! Check out the collection of recent release notes here.

Wanna give new features a try? Get CLion (or any other IntelliJ-based IDE) with the Rust plugin now!

Download CLion

Your Rust Team

JetBrains
The Drive to Develop


What to expect? CLion 2018.3 roadmap

$
0
0

Hi,

A big CLion 2018.2 release has happened just recently. Have you tried the new version yet? If not, get your free 30-day trial on our site now. Clangd, new project models, Google Sanitizers, and many other goodies are waiting inside!

Meanwhile, we’ve already discussed and planned future improvements for CLion and would like to share our plans with you. But first, let’s follow our good tradition and thank our evaluators!

Special thanks

We’d like to thank all evaluators for helping us ship so many great new improvements in CLion 2018.2. The huge variety of your projects and setups made this task much easier for us! These 3 contributors to CLion’s Early Access Program deserve a special mention:

  • Sebastian Hofstetter – we’d like to especially thank Sebastian not only for detecting a clangd issue on Windows, but also for his detailed investigation which led to easy and quick understanding of the problem on our side.
  • Tesla Ice Zhang
  • Alexey Klimkin

In appreciation of your efforts, we present each of you with a free 1-year subscription for CLion (to extend your current subscription or get a new one). You will receive a personal email with details on how to claim your license. (If for some reason you do not get any email from us within a week, ping us here in the comments.)

CLion 2018.3 roadmap

We’re keeping focus on the major directions outlined previously, but we now have a clearer vision of particular areas and tasks.

Note: The following is a preliminary plan; we cannot guarantee that all of the features listed below will be included in CLion 2018.3.
  • C++ Support:
    • Clangd-based language engine requires some polishing of the current code, fixes on Windows, and several general pain-points. We’ll also consider moving other code insight features (at least some local ones) to this language engine, one by one.
    • Bug fixing in the current language engine. Better C++17 knowledge will likely be also added to CLion’s own engine.
  • IDE performance:
    We’ll continue our incremental job of fixing UI freezes and improving performance across the board.
  • Remote development:
    The first prototype is under development and we really hope to include it in v2018.3. The target system will likely be limited to Linux.
  • Project Models:
    • Improve compilation database integration in CLion.
    • Add an ability to build/run projects from compilation database through user-defined commands.
    • Investigate other project models and continue our work on project model API in CLion.
  • Formatter:
    • Integrate clang-format as a separate tool for explicit code reformatting.
    • Consider importing formatting settings from the clang-format files.
  • Debugger:

As usual, your feature requests and suggestions are welcome in our tracker.

Your CLion Team
JetBrains
The Drive to Develop

CLion 2018.2.1 update enables clangd on Windows

$
0
0

Hi,

CLion 2018.2 release has happened just recently. And today we are happy to announce that the first bug-fix update 2018.2.1 is now available. If you haven’t yet upgraded to CLion 2018.2, good time to do so right now!

Get a fresh build from our website, use Toolbox app or snap packages (in the case of Ubuntu) to update. A patch-update will be available shortly for those using CLion 2018.2.

Download CLion

Clangd-based language engine on Windows

In this build the experimental clangd-based language engine is finally enabled by default on Windows (previously we enabled it by default on Linux and macOS)! It’s still used only to show errors and warnings in the editor, however that means that you get more accurate error highlighting on all platforms by default.

If you experience any issue with it, report it to our tracker, customize the settings or turn the engine off in Settings/Preferences | Languages & Frameworks | C/C++ | Clangd.

And more

Other fixes include:

  • A fix for a UI freeze when sanitizers are used (CPP-13341).
  • Fixed poor performance of VCS repository detection (related to symlinks).

Full release notes are available by the link.

If you are interested in what’s coming in CLion 2018.3, check the preliminary roadmap here.

Your CLion Team
JetBrains
The Drive to Develop

Working with Makefiles in CLion using Compilation DB

$
0
0

One of our most frequent feature requests for CLion is the ability to use project or build systems other than CMake. There are many good reasons for needing to use something different – but if you could only pick one we still feel CMake is the best choice. That’s not because we think it is perfect (although it’s worth noting that some of the issues that people have with it may be addressed by focusing on “Modern CMake”). Instead it’s because CMake is in very widespread use – especially in the open-source world, where it has become the de-facto standard.

CMake also has the advantage that it is a meta-build system. It can generate build files for other major build systems. In fact that is really the only way works, although CLion uses it in a way that mostly hides that from you by default (generating Makefiles behind the scenes).

While this is a great starting point, we do want to support other build systems and project formats and work has been progressing over the last couple of releases towards fully decoupling CMake. The initial results of that ongoing work have been: support for Cargo (for Rust projects) in 2018.1, a third-party plug-in for Bazel, and, in 2018.2, Gradle C++ projects and the ability to open Compilation Database JSON files. This is just the start, but is also a lot more useful already than you may realise. To find out why we need to look at what a Compilation Database actually is.

What is a Compilation Database?

In the most general terms a Compilation Database is simply the collection of all information needed to compile a source file, or set of source files – on a file-by-file basis. That includes the filename, all flags and other arguments to be passed to the compiler and the directory to invoke the compiler from (this affects relative paths).

More practically a Compilation Database is most often serialised as a JSON file and comes out of the Clang tooling world. It has become an important mechanism for interoperating between different tools that need to know how code should be compiled – even if not for compilation itself.
Compilation DB JSON files can be generated by an increasing number of build systems and other tools.

What does this mean for CLion users?

Now that CLion can open Compilation DB JSON files it means it can effectively understand projects from many more build systems.
This gives CLion full code-completion, static analysis, navigation and even refactoring on such projects. For 2018.2 we don’t yet have build (except for individual files) or debug capabilities – but these are planned for an upcoming release.

To see just how useful this is, we’ll work through a couple of examples.

Compilation Database Generator

Before we get to the examples themselves, we’ll need to install a tool that can generate Compilation DB JSON files from Makefiles. The tool we’ll use for this tutorial is compiledb. It’s written in Python, so the simplest way to get it is to use pip.

$ pip install compiledb

(you may need to do this with sudo)

Example 1: OpenSSL

OpenSSL is a large, mature, well-known and widely used, open source code base. It’s written mostly in C and has an incredibly complex build system using generated make files.

If you want to follow along you can find the source hosted on GitHub. Taking a fresh clone of this repository you’ll notice it has no Makefiles yet. Like many large, complex, make-based projects you must first run a configuration step that generates the Makefile. Full instructions are in the text file INSTALL in the root of the repository. For Unix-based OSs (including Linux and Mac OS/X/ macOS), the first step is to execute the configure step in a shell:

$ ./config

(Note there are some prerequisites, such as having Perl 5 with core modules – see the INSTALL file for more details).

This runs briefly and, hopefully, completes with no errors, leaving a Makefile in the same directory. If you open the Makefile you’ll see it is not really for human reading – and certainly not for modifying. But now we can use it to give CLion insight into how the codebase should be understood.

To do that we now need to generate a Compilation DB JSON file:

$ compiledb -n make

(passing -n stops make from performing the actual build. If we omit it it will build the whole of OpenSSL at the same time).

This should tell us that it is “Writing compilation database with [some number of] entries to compile_commands.json”.

We can now open the directory in CLion.

Open directory

CLion will detect the compile_commands.json file and look in there for its project information. You may see it think about it for a few seconds, then show the “Compiler Info” tab on the Build tool window, telling you that everything finished ok (there were any errors or warnings you’ll see them in the “Sync” tab).

Compiler Info tab in Build tool window

We can now explore the codebase in CLion. What better way to start than to do a “Search Everywhere” (hit the Shift key twice) and type aria.c to bring up one of the source files. Assuming indexing has finished (which shouldn’t take long) we should instantly find this file.

If we open that and browse through you’ll see full syntax highlighting. Half of this file is #ifdefed out. The second half should lack highlighting and code insight features as OPENSSL_SMALL_FOOTPRINT is not defined (if you used the default configuration).

Find one of the functions (in the enabled first half), e.g. aria_encrypt. If you “Find Usages” on this it will find all the usages in other files in the project.

Find Usages

So now we can finally find our way around large Makefile codebases like OpenSSL.
But because OpenSSL’s make files are generated, we shouldn’t modify them ourselves. Let’s look at a simpler example to see what happens when we do.

Example 2: Modifying Makefiles

For this example we’re going to consider a very simple Makefile. It doesn’t matter what the code does. What’s important is that it has two or more source files, but is simple enough we can easily see what the Makefile is doing. Here’s a starting point:

appname := question

CXX := clang++
CXXFLAGS := -std=c++11

srcfiles := main.cpp foo.cpp
objects  := $(patsubst %.cpp, %.o, $(srcfiles))

all: $(appname)

$(appname): $(objects)
  $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $(appname) $(objects) $(LDLIBS)

clean:
  rm -f $(objects)

Notice here we have two source files. To keep things even simpler we’ll leave out discussion of how to automatically extract header file dependencies.

Now, as the project grows you’ll probably want to add additional source files – or make other changes to this make file. If we do that it’s going to get out of sync with the Compilation DB that CLion is working off.

We can, of course, drop to the terminal and invoke compiledb again every time this happens. But that’s tedious and can be error prone. In any case we’re programmers. We like to automate things!

That’s where CLion’s File Watchers come in. File Watchers are a powerful feature in CLion that allows us to trigger external tools or scripts in response to changes in specific files.

Before we get started we’ll need to make sure that CLion is aware of Makefiles. We can do that by adding the Makefile support plug-in (Preferences->Plugins->Browse Repositories, “Makefile support”)

Browsing plugin repositories

Once installed (you’ll need to restart CLion) if you open the Makefile you’ll see it is now syntax highlighted. But that’s not why we needed the plugin.

With the Makefile open, go to preferences again, and this time find “File Watchers” (under “Tools” – or just start typing “Watch”). Click the + at the bottom left and select “” from the list of templates.

Give the new File Watcher a name, like “Makefile watcher”, and from the “File type” dropdown select “GNU Makefile” (start typing “make” on the field to find it quickly). That’s what we needed the plugin for.

Fill out the rest of the fields as below (or set “Show console” to your choice):

Creating a new File Watcher

After you click OK, CLion will start monitoring the Makefile and, if it changes – whether from inside the IDE or externally – it will trigger compiledb to run again, regenerating the Compilation DB. To verify this, open the compile_commands.json file side-by-side with the Makefile. Add or remove source files from the srcfiles variable and watch as compile_commands.json is regenerated automatically.

At time of writing there is still a limitation as the Compilation DB itself is not automatically reloaded by CLion. You’ll have to ask CLion to reload it (Tools->Compilation Database>Reload Compilation Database Project). So this is not quite seamless yet. Please upvote this ticket if this is something you’d like to have.

Something to build on

We’re not stopping here. We’ll continue working towards supporting more build systems and project formats in more integrated ways. But as of now there are some very useful and valuable options you can take advantage of today.

CLion 2018.2.2 EAP

$
0
0

Hi,

CLion 2018.2.2 EAP (build 182.4129.15) is now available. Get it now from our Confluence page:

Download CLion 2018.2.2 EAP

Please, note that this EAP build requires an active subscription (or you can start a 30-day evaluation period). A patch-update will be available shortly (in case you are using CLion 2018.2.1).

This build includes the following improvements:

  • Performance improvement for CMake projects generation/loading.
  • When debugging on Windows, if you prefer to run the app in the separate console, not in the one integrated into CLion (which happens by default for GDB version 8.0 and higher), you can turn it on in Registry via the cidr.debugger.gdb.workaround.windows.forceExternalConsole setting.
  • Clangd-based language engine got a few improvements:
    • Correct handling of header search paths for non-CMake projects (CPP-13715).
    • Better diagnostic in case of unresolved includes (CPP-13498).
    • Performance optimization (CPP-13729).
  • Several issues related to enums were fixed in the CLion’s own language engine: CPP-7797, CPP-4957, CPP-6138

Full release notes are available here.

Your CLion Team

JetBrains
The Drive to Develop

CLion 2018.2.2 bug-fix update

$
0
0

Hi,

CLion 2018.2.2 update (build 182.4129.51) is now available!

You can download it from our website, use Toolbox app or snap packages (in the case of Ubuntu) to update. A patch-update will be available shortly for those using CLion 2018.2.1 or CLion 2018.2.2 EAP.

Download CLion

This update includes a performance improvement for CMake projects generation/loading, a workaround to run the app in a separate console when debugging on Windows, several improvements to CLion’s own language engine and an experimental clangd-based engine. More details can be found in the previous blog post and the full release notes are available on confluence.

Your CLion Team

JetBrains
The Drive to Develop

IntelliJ Rust features. Entry one: Macros

$
0
0

In this series of short blog posts, we are going to take a closer look at the key Rust related features present in JetBrains IDEs through our corresponding plugin.

However, before we do that, let me briefly remind you about the current state of the Rust plugin:

  • It’s available in all our IntelliJ-based IDEs.
  • It relies on the Cargo build system, and CLion is no exception here!
  • The debugging feature for Rust code is currently only available in CLion.

While macros are essential for Rustaceans, they can be finicky from time to time. Fortunately, there are tools around to help ease your burden.

Let’s create a macro foo! that takes an identifier, a type, and an expression and generates a simple function with a given name and type that will just return the given expression in its entirety.

As soon as we invoke it with fitting arguments anywhere in the code, the proper type inference shows that the macro result is now fully acknowledged by the IDE! Smart Code Completion already knows what the resulting code of the macro can be, and applicable items are suggested accordingly. It is really quite handy.

Here’s an example of how it works with the popular error_chain crate which is based on macros and can be used to straighten out your error handling:

You can also take a look under the hood yourself with a convenient popup. Just right-click an invocation and choose one of two options:

Show expanded macro to see the result of one in particular that you want to look at and ignore subsequent internal invocations, or Show recursively expanded macro to look through all of them:

It’s even aware of the methods declared by a macro:

Rust functionality is easy to include and can be found inside the Plugins tab in the settings of your JetBrains IDE of choice: Settings | Plugins.

Though, the debugger for Rust code is currently exclusive to CLion.

To learn more about the plugin, check out the link.

Thanks for reading this, and see you soon!

Respectfully,

The Rust team

CLion 2018.2.3: better compilation database integration

$
0
0

Hi,

CLion 2018.2.3 update (build 182.4323.58) is now available!

You can download it from our website, use Toolbox app or snap packages (in the case of Ubuntu) to update. A patch-update will be available shortly for those using CLion 2018.2.2.

Download CLion

CLion 2018.2 added a support for compilation database project format. This bug-fix update improves the integration.

Automatically reload compilation database

If you make changes in compile_command.json file, you can now force CLion to automatically detect them and reload the project. This is especially useful when working with Makefiles in CLion through the compilation database: file watchers monitor changes in Makefiles, regenerate the compilation database and CLion reloads it automatically. See the example described step by step in our webhelp.
To enable the Auto-import go to Settings/Preferences | Build, Execution, Deployment | Compilation Database:
compdb_autoimport

Besides, we’ve also fixed a bug that caused Cannot get compiler information errors for files with relative paths in case of compilation database (CPP-14083). By the way, the issue was caught on Ruby sources. So now you can open it in CLion successfully!

Other improvements

CLion 2018.2 comes with Google Sanitizers integration. To let Sanitizers convert addresses into source code locations and make stack-traces easy to understand, one have to ensure that the PATH or *SAN_SYMBOLIZER_PATH environment variable contains the location of llvm-symbolizer. In case of using Clang compiler, you will get a notification from CLion if none of the PATH or *SAN_SYMBOLIZER_PATH variables points to llvm-symbolizer:
cl_sanitizer_symbolizerwarning

Besides, bundled CMake version was updated to 3.12.1.

Full release notes are available by the link.

Download CLion

Your CLion Team

JetBrains
The Drive to Develop


Meet JetBrains C++ team at CppCon 2018

$
0
0

cppcon
We are happy to announce that this year the JetBrains C++ team will be back to CppCon in Bellevue, WA, USA – the biggest yearly event in the C++ development world – as exhibitors, participants and speakers! We greatly enjoyed it last year and are super-excited to join again!

Learn with us

JetBrains team is planning to present a selection of topics in the main program:

Monday, September 24, 14:00 – 15:00
Modern C++ Testing with Catch2, a talk by Phil Nash

Monday, September 24, 16:45 – 17:45
Class template argument deduction in C++17, a talk by Timur Doumler

Tuesday, September 25, 14:00 – 15:00
What Could Possibly Go Wrong?: A Tale of Expectations and Exceptions, a talk by Simon Brand and Phil Nash

Wednesday, September 26, 16:45 – 17:45
Parsing C++, a talk by Timur Doumler and Dmitry Kozhevnikov

Friday, September 28, 09:00 – 10:00
Debug C++ Without Running, a talk by Anastasiia Kazakova

Saturday, September 29, 09:00 – 17:00
Accelerated TDD: For More Productive C++, a class by Phil Nash

Share feedback and watch product demos

On Monday, September 24, JetBrains will have a big booth on the first floor of the Meydenbauer center. Then on Wednesday, September 26, and Thursday, September 27, we’ll be available with a table in the regular exhibition area on the upper floors. Drop by and ask any questions you may have about CLion, AppCode or ReSharper C++, learn a couple of useful tips, find out our future plans, watch demos, or just chat about C++ with the team. We’ll also have nice presents to give out so don’t miss it!

Participate in our license raffle and win a free 1-year subscription! Even if you don’t win, we’ll send you a guaranteed discount towards a personal 1-year subscription to any JetBrains C++ product of your choice.

Tuesday, September 25th, from 20:30
Tool Time will be running at CppCon for the first time ever, which is another great opportunity for attendees to come and chat directly with people who maintain software tools. Both CLion and ReSharper C++ teams will join the event.

See you soon!
The JetBrains C++ Team

CLion 2018.2.4 bug-fix update

$
0
0

Hi,

CLion 2018.2.4 bug-fix update, build 182.4505.18, is now available for download!

You can download it from our website, use Toolbox app or snap packages (in the case of Ubuntu) to update. A patch-update will be available shortly for those using CLion 2018.2.3.

Download CLion

This build addresses the following issues:

  • Incorrect braces were added to the if clause, when autocompleting the if clause before that one (CPP-12049).
  • A few issues with the diff dialog (CPP-12881, CPP-13350).

Besides, CLion now bundles CMake 3.12.2.

Full release notes are available by the link.

Your CLion Team

JetBrains
The Drive to Develop

CLion opens 2018.3 EAP: initial remote dev support, unit testing performance improvements, and new Search Everywhere and Run anything dialogs

$
0
0

Today we are starting the new CLion 2018.3 Early Access Program! There are big plans for this release, and we will do our best to achieve as much as possible. We welcome all of you to give the new features and enhancements a try, and share your feedback with us.
800x400_blog@2x
Find below a detailed description of the following new features and improvements:

Download CLion 2018.3 EAP

Initial remote development support

A while ago we started working on remote development support in CLion. And in this EAP we are excited to announce that we have already been able to add initial support which is ready for you to try! It works for Unix-like (macOS, Linux) local client machines and Linux as a remote host. We assume that your source files are on the local machine and that CLion will automatically synchronize them to the remote host. With just a simple configuration step you can get CLion, which runs locally, to build, run, and debug your application and its tests on a remote machine. For more details, please, refer to this detailed blog post.
remote run ap

Unit testing

Performance

CLion integrates with Google Test, Boost.Test, and Catch frameworks for unit testing. The integration provides you with a built-in test runner, framework specific Run/Debug configurations, icons in the left gutter which report the status of the tests. In the case of Google Test, there is also a test generating feature that helps to create test and test fixture stubs. In this EAP we’ve reworked the whole integration in order to resolve dozens of performance issues (UI freezes when navigating to test results, performance issues when completing test macros, etc.). There has been a huge amount of work gone into reworking the whole integration which will hopefully make your work with unit tests in CLion much more pleasant thanks to the more responsive UI.

Show Test List

Test detection in CLion is implemented in a lazy manner to reduce indexing times. Thus for diagnostic purposes, we’ve implemented a new action “Show Test List”. You can call it from the Find Action dialog, and it will open a text file with a list of all the tests (Google Test, Boost.Test or Catch frameworks are detected) currently detected in the project. Note, the action currently doesn’t trigger test indexing.
show test list

Output processing

We have introduced a few fixes in this build to get more accurate test results’ processing:

  • Google Test: Problems with the colored output (CPP-10823)
  • Google test: cerr output not shown in UI (CPP-10821)
  • Tests with a non-ascii name are now recognized (CPP-11497)
  • Google Test: printing in stdout/err breaks output (CPP-4780)
  • CLion now supports OpenCV GTest modification (CPP-13680)

Quick Documentation: formatted macro expansion

The Quick Documentation popup is really handy when you work with macros, as it shows you the final macro replacement, so you can quickly understand the code that will be substituted after the preprocessor pass. But when you have a complicated deeply nested macro, the final replacement might not work for you if not formatted properly. That’s why CLion now formats the macro replacement in the Quick Documentation popup and also highlights strings and keywords used in the final substitution. For example, this is how it looks for the Boost.Test macro:
boost_test_replacement
And here is the replacement for the Catch test macro:
catch_test_replacement

Validation for compilation database files

CLion 2018.2 introduced compilation database project model support. Which meant that you could now open compile_command.json files, created in advance, as project files in CLion. In this version, we’ve added specific inspections to check the compliance with the compilation database JSON schema. For example, it notices when you use a wrong type:
comp_db_compliance
or miss the property completely:
comp_db_compliance_2

New Search Everywhere

The new Search Everywhere popup was introduced in all IntelliJ-based IDEs in 2018.3 EAP. Our main goal was to solve a lot of the annoying issues with dialog performance, losing focus, incorrect resize, and other things like this.
Moreover, now this popup incorporates several actions at once: Search Everywhere (Double Shift), Find Action (Ctrl+Shift+A / ⇧⌘A), Go to class (Ctrl+N / ⌘O), Go to file (Ctrl+Shift+N / ⇧⌘O), and Go to symbol (Ctrl+Alt+Shift+N / ⌥⌘O) action. Each one has its own separate tab in the dialog, and you can use TAB to switch between these tabs. And all the specific action shortcuts still work, so for example, Ctrl+N / ⌘O will open Classes tab:
search everywhere

Universal Run Anything dialog

Another universal dialog in IntelliJ-platform IDEs is called Run Anything, and you can open it with Double Ctrl. It allows you to:

  • Search and launch any configuration
  • Open a project (just type “Open” and select the desired project from the list)
  • And even debug any configuration of your choice (hold down the Shift key, and the dialog will switch to Debug Anything mode)

run anything

Other improvements

Among the other important changes we’d like to highlight:

  • The “Mark as Plain Text” action is now available in CLion. It allows you to remove big and complicated files from indexing, so disabling smart assistance for such files (for example, code completion, navigation, refactorings) and improving the IDE’s performance. And you can easily revert the files back at any time from the context menu.
  • CLion now parses C++17 fold expressions and C++17 deduction guides correctly. For the user this means not only less false code highlighting, but also better code assistance, for example, for the user-defined deduction guides:
    deduction_guides
  • Bundled GDB version was updated to 8.2.
  • An important issue with CMAKE_TOOLCHAIN_FILE was fixed in this version. A bug caused system include directories and system #defines to be incorrectly detected, which lead to the incorrect coding assistance (CPP-11250).

That’s it for now! The full release notes are available by the link.
Get the new build from our site and give it a try today! Your feedback is very welcome here in the comments and in our tracker.

Download CLion 2018.3 EAP

Your CLion Team

JetBrains
The Drive to Develop

Stay local, let your IDE do remote work for you!

$
0
0

CLion’s issue tracker has dozens of important and interesting feature suggestions to implement. With limited resources, we are always having to prioritize the features we include with the direction we have in mind for the product’s evolution. 3-digit issues with over 800 supportive votes – these are the kinds of requests we can’t leave out! Can you guess the one we’re working on for v2018.3? It is all about remote projects support!

Initial remote projects support – what’s that?

We’ve started with a particular set-up, though we do plan to cover and come to up with more cases in the future. So we are calling the current support state – initial. What exactly was implemented then?

  • Local client machine: Unix-like (macOS, Linux)
  • Remote host: Linux
  • Sources location: originally on the local host, CLion will synchronize to the remote machine for you.
  • Project model: only CMake projects
  • rsync is required to be installed on a remote host

We know there are many other cases for remote development and we are planning to extend our support for it in the future. Just sit tight and stay tuned!

How to configure a remote project in CLion?

It is much easier than you imagine! Just follow these steps.

  1. First of all, go to Settings/Preferences | Build, Execution, Deployment | Toolchains:
    • Create a new toolchain (we call it Remote in our sample)
    • Check the Remote Host option
    • Configure the credentials to access the remote host:
      remote_toolchain
    • Set paths to the CMake executable and debugger on the remote host (it has to be done manually for now, while the default /usr/bin/cmake and /usr/bin/gdb are set for you)

    Now, if the remote host is accessible by ssh with the given address, port, username and password, the toolchain check will finish successfully and the toolchain will be available for use in CLion:
    remote_connected

  2. Now you need to connect a CMake profile (the one that currently exists, or a newer one) to the newly added remote toolchain. Do this under Settings/Preferences | Build, Execution, Deployment | CMake:
    remote_cmake_profile
    Later in this blog post, we’ll see how we can skip this step by simply making the remote toolchain the default one.

After applying these changes, CLion will reload the CMake on this project and you’ll then be ready to start working remotely with your project in CLion:
remote_cmake_reload

Remote development – what can I do?

Now you have a remote toolchain configured and a CMake profile that uses it. Using then our Debug-Remote as an example. You can now:

  • run your app
  • debug your app
  • run tests
  • debug tests

All completely remotely from the instance of CLion on your local machine. And it’s really then as easy as just selecting a proper CMake profile in the build type switcher:
remote run ap
The same goes for tests:
remote run tests

We hope to enable Valgrind and Google Sanitizers in the remote mode soon as well.

What’s going on in CLion under the hood?

Let me now briefly explain what CLion actually does when the described ‘remote configuration’ operations are performed. If you are not interested in the inner mechanics, then feel free to simply skip this part.

During the first step the connection entity is created, you can review the settings under Settings/Preferences | Build, Execution, Deployment | Deployment:
remote_web_deployment
Mappings tab settings, the deployment path, in particular, is configured automatically by CLion and has the path to the remote host where CLion synchronizes your project code:
remote_deployment_path
The synchronization process is displayed in the File Transfer tool window (View | Tool Windows | File Transfer):
file_transfer_toolwindow
Apart from synchronizing the local files to the remote host, CLion also grabs header search paths with all the content to the local host, so it can resolve your code correctly. This means that the standard library headers, for example, are taken from your remote machine, but you can navigate to them as you would to the local files with CLion’s editor.

Stay fully remote all the time with ease

To end this introduction into this awesome new feature, we’d like to share with you a very simple way to use CLion in this remote mode for all your projects, existing and new.
Go to Settings/Preferences | Build, Execution, Deployment | Toolchains and make your remote toolchain a default one by simply moving it to the top of the toolchains list:
remote default toolchain

Now, this remote toolchain will be used automatically for all the projects you open in CLion. For example, when you checkout a new project from Git:
open remotely

There are a few known issues already, they are linked to the parent ticket here. For example, a potential performance issue when too many remote toolchains are created.

That’s it! Give this CLion remote development feature a try and let us know what you think!

Download CLion 2018.3 EAP

Your CLion Team

JetBrains
The Drive to Develop

CLion 2018.3 EAP: fixes for remote dev and more

$
0
0

Hi,

Please welcome a new CLion 2018.3 EAP (build 183.2940.13)!

As usual, a patch-update will be available shortly for those using the previous EAP build, and you can also use Toolbox app or snap packages (in the case of Ubuntu) to get this 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.3 EAP

Last week CLion 2018.3 Early Access Program started with the Initial Remote Development support. This week a new build is available and it addresses an issue with the symlinks used in header search paths (CPP-14211).

Talking about the header search paths, we’ve also fixed an issue with searching through the user and libraries header search paths:

  • #include <..> now looks for the header files in the libraries only.
  • #include ".." first looks in the user’s search path, then in the libraries

This fix actually means that the user header file shouldn’t hide a library header by mistake.

There are also several UI fixes across the whole IntelliJ platform, like for example drawing characters in Monospaced font was fixed (JRE-847).

Full release notes are available by the link.

Your CLion Team
JetBrains
The Drive to Develop

Viewing all 681 articles
Browse latest View live