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

CMake support in CLion

$
0
0

All work in CLion is done within the context of a project. Projects serve as the basis for coding assistance, bulk refactoring, coding style consistency, and other smart features.

CLion now relies on CMake as a project model. It takes all the information about the project from CMake build system. You can specify which files are included in the project, which C++ standard to use, and where to search for header files.

Any CMake-based projects can be opened easily in CLion, with no additional configuration needed: simply point it to the root CMakeLists.txt file in your project sources. You can also import non-CMake projects (File | Import Project…), for which CLion will generate a CMakeLists.txt file.

CMake project settings can be found in Settings/Preferences | Build, Execution, Deployment | CMake dialog, and Tools | CMake menu shows several useful CMake-related actions:
cmake_menu_tools

While editing CMake files in CLion, you can use auto-completion for file names and CMake commands:
cmake_commands_completion
Additionally, CLion can apply CMake files changes automatically.

If you are interested in these and some other CMake-related features in CLion view our demo:

Sincerely yours,
The CLion Team


CLion 1.0 has finally arrived!

$
0
0

Hi everyone,

We are really excited today to tell you that CLion 1.0, the very first release of our cross-platform C/C++ IDE, is here!
1200x628_Facebook_cover_huge

We first announced this IDE on April Fool’s Day, nearly two years ago. A private preview happened after a year of hard work, followed by a public one 6 months later. In all this time we’ve received tons of exciting feedback, hundreds of spot-on feature requests, and millions of words of encouragement that has kept our team going. With 30,000 downloads during the first month of public EAP, and more than 6,000 active users every week, there’s hope we are on the right track.

Today, as we are rolling out CLion 1.0, please give a warm welcome to this latest addition in our family of IntelliJ-based IDEs!

Special thanks to our EAP users

We are grateful to everyone who has evaluated private and public preview builds, shared feedback and reported issues to our tracker. This dialog has been instrumental in raising the quality of CLion 1.0. Contributions from several EAP evaluators have been the most valuable and deserve a gift of Free Licenses. Here they are:

  • Richard Thomson (YouTrack handle: legalize)
  • Alexey Dmitriev (YouTrack handle: RiaD)
  • Drew Noakes (YouTrack handle: drewnoakes)
  • Maxim Babenko (YouTrack handle: Maxim_Babenko_yLH6)
  • Alexander Münch (YouTrack handle: theHacker)
  • Axel (YouTrack handle: devnrev)

We will send you a personal message with details on how to claim your license.

We’d also like to mention the first 7 followers of our @clion_ide twitter, who followed the account even before its official announcement:

We’ll reach out to you on twitter in a day or two asking where to send your licenses.

(If you see your name/twitter account above and you don’t hear from us within a week, ping us here in the comments.)

Webinar – CLion: A Modern C++ IDE

If you’d like to first see CLion 1.0 in action, and learn how you can benefit from using it, consider joining our free webinar on May 6, 2015. Register today to save your seat.

CLion 1.0 Features

Read on for an overview of what’s inside CLion, how C/C++ developers can benefit from using it, and what kind of licenses are available.

Cross-platform IDE for C, C++ and more
CLion 1.0 is available on 64-bit Linux, OS X and 64-bit Windows, and is designed for developing in C and C++. The IDE supports the C++11 standard and handles preprocessor directives. In addition, it provides support for JavaScript, XML, HTML and CSS.
You can use GCC or Clang as the compiler on Linux and OS X, and MinGW 32/64 or Cygwin on Windows.

CMake
For a number of reasons CLion relies on the CMake build system and uses it as the project model. This means it takes all the information about your project from CMake files, including source files, compiler settings, targets description.

All the changes you introduce in CMakeLists.txt files are handled automatically. This can be configured in Preferences/Settings | Build, Execution, Deployment | CMake, together with the options to pass to CMake command, system environment variables and some build options:
cmake_settings
CLion also includes the CMakeCache editor, autocompletes CMake commands for you, and adds new files automatically to the existing targets (offering to select them from the targets list):
new_class_target

Powerful editor and one-click navigation
CLion includes many features to help you code with ease and pleasure:

  • Smart autocompletion filters the suggestions to match the left value type.
  • Multiple cursors handle several editing tasks at a time.
  • Code autoformatting takes care of the prefered coding style guidelines.
  • Keyboard shortcuts help you select, rearrange and comment your code quickly.

If you are not sure which parameters to pass to a function, just use the Parameter Info feature (Ctrl+P on Linux/Windows, ⌘P on OS X):
param_info
All the possible function signatures and parameters will be listed, and as you edit the parameters, CLion will grey out any incompatible signatures.

Fast project navigation is essential for effective coding, which is why CLion includes a set of useful navigation features and search abilities. Go to declaration/definition, go to class/symbol/file only by its name, and use Class/Imports/Type hierarchy to navigate more efficiently.

If you simply want to go back to a file you were editing recently, just bring up the Recent files dialog (Ctrl+E on Linux/Windows, ⌘E on OS X):
recent_files

When you want to find usages, CLion understands the context of each symbol: instead of mere text matches, it provides you with actual usages of the symbol.
‘Search everywhere’ makes it possible to look for any item in the source code or elements of the user interface—in a single action.

Code analysis, quick-fixes and refactorings
CLion keeps a watchful eye on your code to help you maintain its high quality. It analyzes your whole code base on the fly, highlighting potential issues. Simply press Alt+Enter to apply one of the available quick-fixes:
quick_fix

When you need to make far-reaching changes to code, like renaming a symbol, reliable refactorings come to the rescue. Rename, Change Signature, Extract Function/Constant/Define/Typedef, Extract Subclass/Superclass, Pull Members Up/Push Members Down, and use other refactorings—and be assured that your changes are safely propagated throughout the code base.

Integrated debugger
For an in-depth look into the execution of your code, CLion provides a built-in debugger (based on GDB). Besides setting line, exception and symbolic breakpoints, you can also add watches; evaluate any expression; change values on the fly to see how that affects your code; and see variable values right in the editor (next to the variable declaration) during a debugging session:
inline_view

And much more…
CLion integrates with popular version control systems, including Subversion, Git, GitHub, Mercurial, CVS, Perforce (via plugin), and TFS. It includes a built-in terminal and can work in a Vim-emulation mode (via plugin) and offers more helpful tools. Please visit our website for details on CLion features.

Check out a short live demo of CLion 1.0 features:

Free trial, prices and licenses

We offer paid commercial and personal licenses for CLion. We do have a special user group program; also, students and open source projects can use CLion for free. Please, see all licensing options and prices.

Of course, anyone can try CLion for free for 30 days. Consider viewing the quick start guide and our Docs & Demos to get up and running.

If you have any questions, please post them in our CLion Discussion Forum, twitter and/or this blog, where you can find news, updates and useful tips and tricks. If you discover any issues, let our support team know or report them in the CLion issue tracker.

Develop with pleasure,
The CLion Team

CLion 1.1 roadmap & ACCU 2015

$
0
0

Hi everyone,

Last week’s CLion 1.0 release brought lots of excitement, along with a shower of comments and suggestions. After celebrating this milestone, we processed all of your feedback to lay out a plan of moving forward to make CLion a better C/C++ IDE.

Summer is a good time to take a deep breath, sit back and polish all the smart features we introduced in v1.0. We plan to release CLion 1.1 by the end of summer, focusing on these areas:

  • Code style changes will cover formatter fixes and various bundled coding styles schemes. This is the perfect time to share your favorite one(s). Post them in the comments below!
  • Debugger improvements will include LLDB integration.
  • Continuing to work on CMake support, we will finish most cases for completion and navigation in CMake files. We’ll also going to fix slightly unexpected behavior where header files aren’t listed in CMakeLists.txt and not included into the project.
  • Autoimport will evolve to hopefully become your indispensable assistant.
  • Last but not least, we’ll continue testing CLion on huge projects to fix freezes and improve the performance.

CLion 1.1 will also include lots of bug-fixing. Your votes for issues in our tracker can help set the right priorities.

Things can change but we’ll try to follow this plan.

We know you are waiting for integration with other build systems, Google Test and more additional tools. They will definitely come to CLion, though not in v1.1. We do appreciate your patience. Stay tuned and follow our updates!

ACCU 2015

In case you’ll be in Bristol this week, don’t miss the fantastic ACCU 2015 conference. Do stop by our booth or simply catch someone from the team in the venue to chat, share ideas, ask for demos, and learn a trick or two from our CLion and ReSharper C++ team members. See you there!

Develop with pleasure!
The CLion Team

CLion 1.0.1 Update

$
0
0

Hey everyone,

First of all, we’d like to thank you for the feedback you provided after 1.0, it really helps us make CLion better.

As we’ve recently announced, we already have the roadmap for CLion 1.1 and starting to work in that direction. However, we of course are going to periodically publish bug-fix updates for version 1.0. The first update contains the following noticeable improvements and fixes:

Here is the full list of fixes.

The build can be downloaded directly from our site, or using ‘Check for Updates…’ action from the main menu.

Yours as always,
The CLion Team

Webinar agenda: CLion, A Modern C++ IDE, May 6th

$
0
0

In a day we’ll run a free webinar CLion: A Modern C++ IDE with Dmitri Nesteruk. Register now to join us.

During the webinar we are going to cover the following topics:

  • Getting started with CLion: How to tune CLion to look and act the way you want.
  • CMake support: What is CLion’s idea of a project? How does the IDE help with editing CMake files?
  • Code generation: What kind of constructs can CLion help you generate? What are live templates and surround with templates? How can one add new code templates and share them with the team?
  • Code navigation: How does one find classes, class members or files or walk up an inheritance hierarchy? How does one benefit from the hierarchical views? How to switch between the source file and the corresponding header file in one shortcut?
  • Refactorings: What are the C++ refactorings in CLion? Why do we call them reliable?
  • Code analysis: How to search for unreachable code? How can the DFA can help? What are quick-fixes for?
  • Tools on board: What else is there except the editor?

You’ll be able to ask questions online through a special question form, but don’t hesitate to leave comments below if some useful topic is missing or some big question needs an answer.

Join us Wednesday, May 6th, 14:00 – 15:00 GMT (10:00 AM – 11:00 AM EDT).

Sincerely yours,
The CLion Team

Webinar Recording: CLion, A Modern C++ IDE

$
0
0

The recording of our May 6th webinar, CLion: A Modern C++ IDE, is now available on JetBrainsTV YouTube channel.

In this webinar, Dmitri Nesteruk shows how you can enhance your productivity while developing in C and C++ with our new cross-platform C/C++ IDE called CLion.

Below are some questions from our webinar answered by Dmitri and Anastasia.

Q: Is it possible to export and enforce code style settings within organisation?
A: Yes, it is. File | Export Settings will help you to export the preferred settings like Code Style, Live Template, UI Settings and much more:
export_settings
File | Import Settings will assist with importing the derived .jar file.

And even more, if you’d like to store the code style settings for the selected project in the Version Control System, press ‘Manage’ button in Editor | Code Style settings, select the configured coding style scheme and press ‘Copy to Project’. The selected code style is saved in the .idea directory in the file codeStyleSettings.xml, so you can now submit this file to VCS.

Q: Can I replace #pragma once with the standard #ifndef/#define include guards in header generation?
A: Dmitri has the default File Templates for C++ header updated with “#pragma once”. You can do this as well, overriding the default templates in Preferences/Settings | Editor | File and Code Templates:
file_templates
As you can see, the standard #ifndef/#define include guards are there by default.

Q:Is there any support for msbuild? I would like to use CLion with UE4 development.
A: CLion is using CMake as a build system for now, and supports GCC/Clang compilers. MSVC and msbuild are not in our roadmap, at least for now, because of the other C++ product we’ve released recently called ReSharper C++, that is a plugin for Visual Studio.

However, as far as we know Unreal Engine development can be based on CMake as well. Following this answer:
“You can definitively get a CMake-driven unreal project. In 4.5 preview, Unreal Engine Linux build process ‘natively’ generates a CMake file (and makefile so) which could serve as input to build the whole engine in whatever IDE you want (I build UE4Editor from QtCreator).”
So feel free to try and share your experience with us!

Q: Does CLion support C++14? Is there an overview of the supported language features?
A: C++14 is not supported yet. Now CLion supports all the C++ standards up to C++11 except for the user defined literals, constexpr and variadic templates. This and some other useful feature related information can be found in our online help.

Q: Where is “override” keyword at autogenerated Human::walk?
A: CLion allows you to select the override specifier to be generated when overriding virtual function (Dmitri followed the other way). However it’s available only in case you’ve pointed C++11 flag in CMake. Otherwise CLion will assume you can’t use override.

Q: Does CLion use the same key bindings as IntelliJ?
A: CLion includes a lot of keymaps bundled. You can select from IntelliJ-based one, Emacs, Eclipse, Visual Studio, Xcode and more.

Thanks to all the attendees for the questions! If you still have some, please, contact Dmitri or our team.

About the Presenter:

Dmitri NesterukDmitri Nesteruk is a developer, speaker, podcaster and technical evangelist. His interests lie in software development and integration practices in the areas of computation, quantitative finance and algorithmic trading. His technological interests include C#, F# and C++ programming as well high-performance computing using technologies such as CUDA. He has been a C# MVP since 2009.

Read more about Tips&Tricks in CLion, follow our blog and twitter (@clion_ide).

Thank you and develop with pleasure!

Debugging in CLion

$
0
0

One of the key advantages to having an IDE instead of a plain-text editor is the debugging experience. Debugging involves being able to pause program execution at an arbitrary point and having the ability to inspect the content of variables.

CLion supports the debugging experience using the GDB debugger. Here’s a look at some of the core debugging features that are supported.

Breakpoints

In order to inspect the state of the program at a particular point, you need to pause the program. Breakpoints are used for exactly this purpose.

A simple breakpoint stops the execution of a program at a particular line. To make one, simply press Ctrl+F8 (Windows/Linux)/⌘F8 (OS X) or, alternatively, click the mouse in the grey gutter area to the left of the code. The line with the breakpoint will be highlighted, and the breakpoint itself will appear as a red circle:

Now, when you run the program in debug mode (by choosing the menu item Run|Debug or pressing Shift+F9 (Windows/Linux)/^D (OS X)), program execution will stop at the line you selected.

A conditional breakpoint will only stop at a particular line if some condition holds. To edit the condition, you can right-click the breakpoint and type in the condition in the window that pops up. You even get code completion right in the editor!

2

With this pop-up window open, you can press Ctrl+Shift+F8/⇧⌘F8 to open up the full breakpoint editing window:

3

Some of the options available here include:

  • Suspend — this check box determines whether the execution pauses at a particular point or not. Leaving this unchecked means program execution will continue, but any breakpoint rules (e.g., logging) will still be executed.
  • Condition — determines the condition on which this breakpoint triggers. Leaving this out ensures that the breakpoint is always hit.
  • Log message to console writes to the console information about the breakpoint being hit.
  • Log evaluated expression lets you log the result of specific evaluation.
  • Remove once hit ensures that after you hit the breakpoint once, the breakpoint is removed. This can be useful in cases where you only want to log the first occurence of a particular point being hit.
  • Disabled until selected breakpoint is hit does exactly what it says: it disables the current breakpoint until some other breakpoint is encountered. This is useful in situations where, for example, you only want to investigate a point in code when it is called from a specific function of your choosing. There are two options here:
    • Disable again disables the breakpoint after it is hit until the dependant breakpoint is hit again (in which case it is re-enabled).
    • Leave enabled leaves the breakpoint forever enabled and thus no longer dependant on any other breakpoint being hit first.

Exception Breakpoints

But that’s not all! In addition to ordinary breakpoints, CLion also supports exception breakpoints which, as the name suggests, trigger when the program throws an exception.

The set of options related to exception breakpoints is similar to line breakpoints: you can specify whether you want to suspend execution, log message to the console, remove the exception once it’s hit, or only enable it when some other breakpoint is hit first:

4

Debugger User Interface

So, what exactly happens when a debugger hits a breakpoint? Apart from the execution pausing, you get to see the following Debug tool window:

There’s a lot going on here, so let’s start by discussing the two primary tabs (the top-level tabs, so to speak). They are:

  • Debugger — this actually shows the various debugging options that we are going to discuss in just a moment.
  • Console — this area shows the command-line output, if your application has any.

Directly to the right of these tabs is a set of buttons that allow you to navigate around the code being debugged. They include letting you

  • Show Execution Point (Alt+F10),
  • Step Over (F8),
  • Step Into (F7),
  • Force Step Into (Alt+Shift+F7),
  • Step Out (Shift+F8),
  • and Run to Cursor (Alt+F9).

There’s also a button that lets you Evaluate Arbitrary Expression (Alt+F8) — we’ll talk about this later.

To the left of the tabs is a vertical column of buttons that contains higher-level controls for debugging, including buttons for resuming execution or stopping the application, an ability do display breakpoint settings, and other miscellaneous controls.

So let’s get back to the Debugger tab. This tab has lots of things going on. First of all, on the left, it lets you actually pick the threads that you want to inspect. Modern applications run on many threads, so you can pick one from a drop-down list:

Directly below that is the stack frame, i.e., a list of the nested functions that were invoked as you were going through the code. Each entry lists the full name of the function (or constructor), the file name and the line number. Clicking the line causes CLion to open the corresponding file at the specified line number:

7

To the right of the stack frame, we have two tabs: Variables and GDB. We’ll talk about variables in just a moment; as far as GDB is concerned, this tab essentially shows the command-line output from GDB itself, since that’s the debugger that’s being used to debug our app.

Variables

The simplest way to view the state of a variable is, of course, in code. Simply hover the mouse over the variable in question and you should see something like the following:

If you press Ctrl+F1 (Windows/Linux)/⌘F1 (OS X) at this point, a window will pop up containing the inner states of the variable you are after:

Of course, you get a more comprehensive view of variables in the Debug tool window. For a chosen function in the stack frame, the Variables tab shows the state of all the variables. In a complicated application, it can get quite busy:

For any one variable we can expand the tree to see its contents:

If you want to cut out the noise a little bit, simply right-click the variable and choose Inspect: this opens up a separate window for inspecting this variable only:

It is entirely possible to actually alter the values of the variables in the debug session. Right-click the variable and choose Set Value. The editor will open in-place over the current value, letting you type in the new value:

GNU STL Renderers

As a special enhancement of the debugging experience, CLion treats STL containers with extra care, making sure you get the best possible representation during the debug process. For example, here’s a look at how an std::map can be presented in the debugger:

This feature works in GCC, and in the case of Clang it works for libstdc++ only. This requires the following setting to be added to CMakeLists.txt:

set(CMAKE_CXX_FLAGS “${CMAKE_CXX_FLAGS} -stdlib=libstdc++”)

Watches

Capturing every single variable at every single point results in far too much information. Sometimes, you want to focus on a specific variable and the way it changes throughout program execution, including monitoring changes when the variable in question is not local to the code you are inspecting. This is what the Watch area of the Debug tool window is for.

To start watching a variable, simply press the Add button (Alt+Insert (Windows/Linux)/⌘N (OS X)) and type in the name of the variable to watch. Code completion is available here too.

Alternatively, pick an existing variable, right-click it and choose Add to watches. Now the window will keep displaying the value of the variable even if you are in some nested part of the stack frame:

Evaluating Expressions

You can see variable states on a breakpoint, but what if you want to see the sum of two variables, or evaluate the result of a function call then and there? There’s functionality for that too. Simply press the Evaluate Expression button (Alt+F8) on the Debug tool window and type in your expression. As always, you get code completion here, and after you press the Evaluate button, the result area below will display the result of the evaluation:

You can also use a shortcut (Ctrl+Shift+Enter) to add this expression to watches. That’s right – watches can contain arbitrary expressions, not just single variables!

Watch CLion debugging features in action:

Conclusion

This post has shown what CLion can do for you when debugging. You can evaluate these features for free for 30 days, simply download the build from our site. Give it a go, and let us know what you think! ■

MUC++ meeting at JetBrains: CMake and CLion

$
0
0

Hi,

In case you are in Munich next week take a chance to learn more about CMake and its support in CLion, and visit our office! We are happy to host MUC++ user group for the CMake-related meeting, Thursday, May 21, 2015, 7:00 PM.

Daniel Pfeifer (the organizer) will give an introduction to CMake and show some best practices for large, multi-component software projects. And Vyacheslav Karpukhin (developer, CLion team member) will cover the integration of CMake into CLion and provide an insight on implementation details and rationale behind it.

It’s also a great opportunity for you to ask any kind of questions about CLion and share your feedback with the team.

Join us next Thursday!

See you,
The CLion Team


CLion 1.0.2 update

$
0
0

Hi everyone,

The second update, CLion 1.0.2, is available for download. You’ll also get an automatic notification about this update right in the IDE, or can do CLion | Check for Updates manually.

A long list of fixes and improvements can be found in our tracker. Here are a few worth mentioning:

  • Since this version CLion supports Cygwin 2.0.0 and MinGW-w64 4.0 toolchains.
  • Create new C++ class dialog now will try to evaluate and suggest you the correct CMake targets name even if add_executable or add_library commands contain variables and not the direct target name. This still can fail for some complicated cases when the variable value is set in some other file or in non-top level constructs.
  • Since now you can select to declare function parameter as const while extracting parameter in CLion:
    declare_const_param
  • The getter/setter generation (Alt+Insert on Linux/Win; ⌘N on OS X) was improved greatly with this build. First, setters are available for union members now. Second, we’ve fixed the behaviour for arrays – correct getters are generated for one-dimentional arrays (can be also static); incorrect code that was generated before in all other cases was removed. By the way, for static members CLion now reasonably suggests static setters.
  • Getters are now inlined correctly (CPP-374).
  • Taking about debug, we’ve fixed a couple of annoying problems: one with command timed out on Windows while stopping on a breakpoint (CPP-840); other is about program execution stop under debug that didn’t work in some cases (CPP-3235).
  • A PTY related failure was fixed for the case when path to CLion contains ‘+’ symbol.

Check the update and let us know what you think.

Sincerely yours,
The CLion Team

CLion 1.0.3 critical update

$
0
0

Hey everyone,

Today we are publishing an update with a fix of a critical problem that arises after updating from 1.0.1 to 1.0.2. The problem may expose itself as not working language features (navigation, completion, highlighting, formatter etc).

We sincerely apologize for the inconvenience and will take measures to prevent such kind of problems in future.

Should you have already filed a bug report for such a problem, we kindly ask you to check if the problem is fixed in 1.0.3 and let us know in the tracker so we could close the corresponding issues.

Yours,
The CLion Team

Code generation with CLion

$
0
0

When you have a brilliant idea in mind, you don’t want to be slowed down by something routine and mundane. Wouldn’t it be great if your IDE got those boring and repetitive tasks out of the way so you could develop at the speed of thought?

Well, that is exactly what CLion does for C and C++ developers, with its vast code generation options. Let’s see what they are.

Create from usage

This concept is so simple that you may not believe it’s true when you see it for the first time. Suppose you’ve used a function that is not implemented or not even declared yet. Your code looks red, sure, but what if you press Alt+Enter?
no_method
CLion suggests creating a new function! Press Enter and voila:
method_created

Going forward, let’s assume you’ve started using a variable name, and, for some reason, it doesn’t exist either. Press Alt+Enter to see what happens:
no_var
Plenty of options here! Select between introducing a new local/global variable, a field, a macro or a function parameter. Let’s go with the first option in this example. Now you have a variable declaration and can proceed with coding:
var_created
The same naturally works for class names.

Intentions

The Alt+Enter shortcut helps you create declarations and definitions for symbols that are already in use. Actually, it can do even more! Intentions let you apply automated changes to code that is correct, to improve it or to make your coding routine easier. To invoke an intention action, use Alt+Enter. The list of all available intention actions (for C and C++, as well as for JavaScript, XML and CSS) can be found in Settings/Preferences in Editor | Intentions.
For example, one intention adds parameters and field initializers to the constructor. While introducing a new member, you can add it to the constructor automatically. A signature preview will be shown so you can reorder parameters or add some extras:
add_param_constructor

There are more intention actions which generate any missing switch case label, or extract the boolean condition from expression and put it to if statement, or apply De Morgan’s laws to a logical expression, or… okay, I’m getting carried away here. The point is, there really are a lot of them, and each can be invoked easily with the simple Alt+Enter shortcut.

Generate getters/setters and constructors/destructors

An intention action can help you add a parameter to a constructor, but what if no constructor is available yet? Or maybe you want your private/protected member to have a getter or a setter. Then what you need is the Generate menu. Press Alt+Insert (or Cmd-N on OS X) and get them all in no time:
generate
Select the fields to generate getters/setters in this dialog. For class constructors, CLion suggests class fields that should be initialized:
generate_constructor

Implement/Override

Did you notice “Override Functions…” and “Implement Functions…” in the Generate menu above? Choose this menu item, or use Ctrl+I to implement and Ctrl+O to override, and CLion will generate stubs for all the selected functions. In C++11, when overriding functions you can use an override specifier:
override_specifier

Templates

If you’ve ever wanted to create many lines of code from just a few symbols, you’ll love CLion’s Live Template mechanism. Type for and press Tab to get a loop; or type iter or itit and then press Tab to iterate over a range:
live_template

Even better, create your own Live Templates in Settings/Preferences Editor | Live Templates! The templates can then immediately be used, shared with your team, or placed in a VCS. To apply a Live Template in code, simply type its abbreviation and press Tab. If the template includes variables, press Enter or Tab to navigate between them.

To quickly wrap code with a construct, like while, if or #ifdef, use ‘Surround With’ templates by pressing Ctrl+Alt+T (on Linux/Windows) or Cmd+Alt+T (on OS X). An expression or a set of statements will be placed inside the selected construct.

As with Live Templates, you can create your own ‘Surround With’ templates. To do that, add a new Live Template that includes a $SELECTION$ variable, and it will be added to the ‘Surround With’ list:
surround_with

Thanks to these powerful code generation features in CLion, you can craft code with much less effort.

If you then want to restructure and clean up your code without changing its external behavior, consider using CLion’s code refactorings.

That’s it for today! Browse the Tips’n’Tricks section of this blog to discover other interesting and useful features of CLion.

Live Webinar: A Tour of Modern C++, July 2nd

$
0
0

Join us Thursday, July 2nd, 14:00 – 15:00 GMT (10:00 AM – 11:00 AM EDT) for a free webinar, A Tour of Modern C++ with Dmitri Nesteruk.

The C++ programming language has moved quickly from relative stagnation to rapid evolution, with new versions of the standard adding sought-after features to the language and standard library. In this webinar we shall take a look at the latest language additions introduced in C++11 and will also talk a little bit about some of the forthcoming features in C++14 and 17.

Space is limited, please register now.

About the Presenter:

Dmitri NesterukDmitri Nesteruk is a developer, speaker, podcaster and technical evangelist. His interests lie in software development and integration practices in the areas of computation, quantitative finance and algorithmic trading. His technological interests include C#, F# and C++ programming as well high-performance computing using technologies such as CUDA. He has been a C# MVP since 2009.

CLion 1.0.4 update: fix for ‘Command timed out’ problem

$
0
0

Hello everyone,

We’ve just rolled CLion 1.0.4 that fixes a very annoying issue with ‘Command timed out’ while debugging. You most probably experienced it if debug tool window kept showing “Collecting data…” forever for you. Or gdb ended with ‘Command timed out’ during the debug session.

We are sorry for the inconvenience. Thanks for you patience and we hope it’s resolved now with this update. Feel free to share the feedback with us.

While our main goal was to deliver you the fix for this critical problem, still some other notable fixes are included as well. For example, some redundant semicolons inserted automatically, plus a regression when a member function was marked as not implemented has been fixed. See the full list of changes.

As usual, a patch update is available or you can download and install CLion 1.0.4 directly from our website.

Develop with pleasure!
JetBrains CLion Team

Agenda of Our Forthcoming Modern C++ Webinar

$
0
0

Hi, everyone!

On July 2nd, we plan to run a webinar covering some of the features of Modern C++. Modern C++ is a really broad topic, so here is an outline of some of the things we are going to cover:

  • Useful new C++ constructs, such as in-class variable initializers, delegating constructors and deleted/defaulted functions as well as raw strings, nullptr and others.
  • Uniform initialization, which simplifies the, ahem, initialization of various objects (e.g., obviating some constructor calls in function return values) and also helps us avoid C++’s most vexing parse. Also introduced is the concept of initializer lists.
  • Automatic type deduction with auto and decltype keywords drastically reduce the amount of code one has to write, and also help us write powerful generic code.
  • The override and final keywords help us control that we are, in fact, overriding a function, or preventing a function from being overridden.
  • Lambdas allow us to easily define anonymous functions instead of building old-fashioned functors. They also happen to be more powerful in C++ than in C#/Java: you can, for example, control which variables get captured and how.
  • Strongly typed enumerations prevent their elements from polluting their immediate declaration scope and offer additional safety.
  • Non-member begin()/end() functions simplify writing algorithms that can operate on different collections (e.g., array or vector) and a range-based for loop, especially coupled with auto, makes iterating collections a lot easier.
  • constexpr and static asserts allow us to perform compile-time evaluations, whereas type traits let us intelligently constrain template parameters.
  • Variadic templates let you write functions with variable number of arguments of any types, resulting in neat things such as the super-useful tie function that finally lets us extract tuple values in a single statement and without those ugly get<>() calls.
  • Smart pointers have come a long way since the days of auto_ptr. We’ll talk about the common types (shared_ptr, unique_ptr and weak_ptr) and their uses.
  • Finally, we shall talk about rvalue references and move semantics that help us avoid needless creation of temporary objects. We’ll cover std::move and how to write your own move constructors and assignment operators.

So these are some of the things we are going to talk about in the webinar. If you haven’t registered for the webinar yet, please register here and we’ll see you on July 2nd! ■

Webinar Recording: A Tour of Modern C++

$
0
0

The recording of our July 2nd webinar, A Tour of Modern C++, is now available on JetBrainsTV YouTube channel.

In this webinar, Dmitri Nesteruk shows the latest language additions introduced in C++11 and also talks a little bit about some of the forthcoming features in C++14 and 17.

Demo project is available on GitHub. And if you have any suggestions or improvements, your pull requests are welcome!

The video includes the time stamps following the agenda announced.

Below are some questions from our webinar answered by Dmitri and Anastasia.

Q: How does constexpr work compared with ordinary meta programming?
A: Constexpr allows for a much cleaner way of performing compile-time calculations when compared to template metaprogramming. Instead of making a template class where the template argument is transformed and exposed as some value member, you can simply write a function prefixed with constexpr and the compiler takes care of the rest.

Q: Is there an overhead using for_each with lamdas(or any stl algorithms) compared with the old for with subscripting?
A: Nope! The range-based for is as fast or faster than doing an ordinary for… provided your iteration variable is a reference. If it’s a value, temporaries are created and the generated code is a bit more complicated.

Q: How is the C++11 style return beneficial over just having the return value in front?
A: One of the reasons why it’s there is lambdas. When you do a lambda it’s more natural to put it towards the end, then towards the beginning.
There is a whole business of decltypes. And you simply can’t prefix decltype because at this location in front we don’t know anything about t and u:
auto_decltype

Q: It would be great to hear about move semantics.
A: Move semantics is a topic that, unfortunately, did not make it into the webinar. Apart from popular literature, I can recommend looking at this stackoverflow question, which has a succinct description of what it’s all about.

There was also a set of questions about CLion and ReSharper C++. We encourage you to visit our site for both products to learn more. If you are interested in a plugin for Visual Studio, please, visit ReSharper C++ site. And if cross-platform case looks more appealing to you, please, go to CLion site.

About the Presenter:

Dmitri NesterukDmitri Nesteruk is a developer, speaker, podcaster and technical evangelist. His interests lie in software development and integration practices in the areas of computation, quantitative finance and algorithmic trading. His technological interests include C#, F# and C++ programming as well high-performance computing using technologies such as CUDA. He has been a C# MVP since 2009.

Thanks to all the attendees for the questions! If you still have some, please, contact Dmitri or our team.

If you are interested in any particular C++ feature, check the C++ reference. We also recommend Scott Meyers’s “Effective Modern C++” book and Bjarne Stroustrup’s C++11 FAQ for some further reading.

Learn more about C++ tools from JetBrains on our site.

Thank you and develop with pleasure!


CLion 1.1 EAP starts with massive overhaul of the parser, LLDB integration and new formatter options

$
0
0

Hi everyone,

Summertime and the livin’ is easy, as the song goes. But not for us, as we’re working to bring you CLion 1.1 and announcing the start of the Early Access Program! CLion 1.1 EAP build 141.1935 is already available for download. As usual, it doesn’t require an active license, and you can have both the latest CLion 1.0.4 and CLion 1.1 EAP installed on your machine.

CLion_EAP
Summer is a hot season, but the hot features we have inside CLion could give it a run for its money. Let’s check them out!

Big parser improvements

You probably know that C++ is a very complicated language to parse. There are so many interesting cases where the overall context can influence the way your code is parsed. Since April we’ve completed a massive overhaul of our parser to make it more accurate and precise. Let me show you a few samples.

Sometimes a function declaration looks very similar to a constructor declaration, but the IDE needs to distinguish them to provide appropriate highlighting, code analysis and refactorings for your code base. Starting with 1.1 EAP, CLion can correctly handle many contexts like the one below:
function

Another similar example is casting a value to some type vs. declaration of a variable:
decltype

Our latest work also affects the parsing of template arguments (CPP-3802, CPP-3758, a fix for the variadic templates CPP-3754), and various typecasting cases like the one below:
cast

These enhancements, introduced deep in the parser, allow us to fix many false positives with incompatible pointer types (CPP-3610, CPP-3612), as well as some initializer warnings (CPP-3613, CPP-3511).

Many other related fixes and improvements are available. If you’ve come across red code or false positives in your code base, give CLion 1.1 EAP a try and share your feedback with us!

LLDB integration on OS X

One of CLion’s key advantages over a plain text editor is the debugging experience. While you can always run a stand-alone debugger separately, debugging inside an IDE saves you time and provides various additional functionality.

Since its very first build, CLion integrates with the GDB backend on all platforms, providing all the essentials in its UI. However, OS X users feel more comfortable with the LLDB. So we’ve improved CLion to provide a more natural experience for that use case as well:
lldb_debug

We’ve bundled version 3.6 into the OS X distribution package, making it the default debugger on OS X. If you use CLion 1.0 on Mac and you install this EAP build, your debugger will be switched to the LLDB for the first time. After that you can either stay with LLDB or come back to GDB manually; your settings will be stored in CLion.

Formatter accuracy

CLion keeps your code well formatted as you type. Alternatively, you can apply formatting rules explicitly with the Reformat Code action. You can also configure the coding style guidelines in Editor | Code Style settings and have CLion make sure you stay compliant with them. To help you reflect your desired guidelines more precisely, CLion 1.1 EAP introduces a set of improvements and new options for configuration.

Most of the improvements have to do with the preprocessor directives and conditionally non-compiled code. CLion 1.1 EAP brings a number of new settings for directives (#define, #if/#endif) indentation to Editor | Code Style | C/C++:

  • In Tabs and Indents | Preprocessor directive indent, the default value is 0, and the relative indent is applied to the nested directives:
    preprocessor_indent
  • Follow code indent, placed below, is responsible for keeping the indent of the directives the same as for the surrounding lines (off by default).
  • In Wrapping and Braces, Keep when formatting group, there is a new option, Directive at first column. It is set to yes by default, and is responsible for keeping the directive in the first column (if it’s already there) in any situations, regardless of other options.

When you start typing ‘#’, CLion will now automatically align this new directive to the correct position. The closing ‘#’ directive (or ‘else’) is aligned after you press Enter:
directive_align

The guard block is an exception for the preprocessor directives’ relative alignment and is handled automatically. The code that is conditionally uncompiled is now formatted correctly, following the configured Code Style settings.

Non-existent declarations no longer break template formatting (CPP-3411). And multiline comments are now handled correctly during auto indentation.

Completion for missing keywords

We’ve also implemented missing completion for a few keywords, including:

  • final
  • override
  • alignas after struct
  • noexcept
  • friend

C and C++ files extensions

Since this build you can configure the preferred C/C++ source/header files extensions and use these combinations while creating a new C++ class, C/C++ source or header file. To add/update file extensions go to Editor | Code Style | C/C++ | New File Extensions settings:
file_extensions
These file extensions are available when creating a new C++ class, C/C++ source or header file:
new_cpp

Custom JDK update

In CLion 1.1 we’ve introduced a custom build of JDK 1.8 with fixes from the JetBrains team. It was very warm welcomed, however had some critical performance problems. This build addresses these issues, as well as a problem with high CPU usage. CLion 1.1 EAP build including updated custom JDK is located on confluence page.

The full list of fixed issues can be found in our tracker.

This is just the beginning for CLion 1.1 as we’ve got more interesting features coming soon! Check out this EAP build, follow the updates and report any problems found to our tracker. Your feedback is always extremely welcome!

Develop with pleasure,
The CLion Team!

CLion 1.0.5 bug fix update

$
0
0

Hi everyone,

We’ve recently started the Early Access Program for CLion 1.1. It includes a lot of new goodies (like LLDB on OS X support, for example). However we’d also like to roll out CLion 1.0.5 bug fix update today.

First of all, this build addresses an unpleasant regression with member functions reported as not implemented when class is located in the namespace. Among other fixes, you can find a set of CMake related improvements:

The build also addresses a fix for autocompletion when using auto keyword (CPP-2998), adds Unused class inspection:
unused_class
and more. See the full list of changes.

As usual, a patch update is available or you can download and install CLion 1.0.5 directly from our website.

Develop with pleasure!
JetBrains CLion Team

New CLion 1.1 EAP: select and use your favourite code style

$
0
0

Hi all,

A preview build for CLion 1.1 (141.2144) is now available for download. Patch update is available from CLion 1.1 first EAP build.

First EAP delivered many new code style options to reflect your desired guidelines more precisely. With this new build we suggest you even more impressive opportunity! While configuring a code style scheme for your projects you can now apply settings from one or several well-known guidelines. They are:

Please, pay attention, that the last three options include only the braces placement rules.

To apply these styles, go to Editor | Code Style | C/C++ settings, find a Set from… option on the right side of the window and select the preferred guideline scheme there:
predefined_style
Changes will be highlighted in the preview window and Reset option will appear (there is a small issue with it now – Reset doesn’t appear immediately, but any action in the settings windows triggers the proper event).

This build also addresses an unpleasant bug in debugger with the option “Hide out of scope values” that also hides this pointer in Variables and Watches views. Find a full list of fixes in our tracker. Download the EAP build now and give it a try!

Sincerely yours,
The CLion Team

Infographic: C/C++ facts we learned before going ahead with CLion

$
0
0

Hi all,

Since the first CLion announcement and public preview build, we’ve received many questions about technologies and toolchains selected to be the first in CLion (CMake, GCC and GDB). We’ve also had a couple of interesting discussions about the C and C++ market on various conferences and here in our blog.

JetBrains has a fantastic Research team that runs some exciting market research studies. They investigate typical user profiles, technologies, pricing and other crucial aspects of product development.

Before going ahead with CLion, we had asked our Research team for insight into the C/C++ market. We wanted to know things like Who are C and C++ developers? What areas do they work in? What tools do they use? and so forth. After a lot of hard work, the Research team gave us the answers we were looking for, and a pack of interesting facts to boot.

From a practical point of view, this research was instrumental in setting our first roadmap. It confirmed our decision to start with the CMake+GCC/Clang+GDB toolchain, and to add LLDB as soon as possible after the 1.0 release.

Take a look at the infographic that sums up the results of our research:

CPP_infogr

Your questions are welcome in the comments below!

Meet CLion, AppCode and ReSharper C++ teams at GDC Europe in August

$
0
0

World famous Game Developers Conference is coming to Cologne, Germany. And we are eager to meet you there!
gdc_europe_2015
Exhibition will be opened during the both conference days, Monday-Tuesday, August 3-4, 2015, and we’ll be happy to show you CLion, AppCode and ReSharper C++ demos, answer any questions, share tips&tricks and just chat about games development at our booth 173.

Be sure to fill our C++ quiz and win a free license and grab some stickers and one of our cool yo-yos. Even if you don’t win a free license, we’ll send you a discount.

See you soon in Cologne and let’s have fun there!
The JetBrains Team

Viewing all 682 articles
Browse latest View live


Latest Images