Quick Start Guide
This Quick Start Guide is designed to introduce the key concepts and help you make a quick start with the IDE.
- Step 0. Before you start
- Step 1. Open/Create a project in CLion
- Step 2. Look around
- Step 3. Customize your environment
- Step 4. Code with smart assistance
- Step 5. Keep your code neat
- Step 6. Generate some code
- Step 7. Find your way through
- Step 8. CMake
- Step 9. Run and debug
- Step 10. Keep your source code under Version Control
- Step 11. That’s it! Go ahead and develop with pleasure!
Step 0. Before you start
What languages does CLion Support?
What platforms can I run CLion on?
CLion is a cross-platform IDE that works on Windows, OS X, and Linux.
Which compilers are supported by the IDE?
What do I need to start with CLion? What are the system requirements?
In general to develop in C/C++ with CLion you need:
- CMake at least version 2.8.11, make.
- GCC/G++ or Clang, which in case of Windows means using toolchains: MinGW 3.* or MinGW - w64 3.*-4.* or Cygwin 1.7.32 (minimum required) up to 2.0.*.".
- GDB: 7.8.* (in case you don’t want to use bundled versions of GDB or LLDB).
CLion includes bundled GDB 7.8 (except for the Cygwin case on Windows), LLDB 3.7 (on OS X), JDK 1.8 and CMake so you don’t need to install them separately. Check the bundled CMake version number in (or if you are OS X user).The system requirements are:
Please,find here more details about requirements for CLion.
Why do you need a CMake project?
Everything you do in CLion is done within the context of a project. It serves as a basis for coding assistance,
bulk refactoring, coding style consistency, etc.
CLion uses the CMake project model. Any CMake-based projects can be opened easily and with no additional configuration in CLion.
Step 1. Open/Create a project in CLion
You have three options to start working on a project inside the IDE:
Open an existing project
Begin by opening one of your existing projects stored on your computer. If your project uses the CMake build system,
you can do the following from the Welcome screen (or File menu in the IDE): click New Project
and locate the
Otherwise select Import Project from Sources and specify the location of the sources, then select project files and include
CLion will then create a CMake project from your sources for you.
Check out an existing project from Version Control
You can also download sources from a VCS storage or repository. Choose Git, GitHub, CVS, Mercurial, Subversion, Perforce or TFS,
and then enter your credentials to access the storage.
Then, enter a path to the sources and clone the repository to the local host:
Create a project from scratch
If you prefer to start from scratch, click New Project on the Welcome screen, enter your project’s name in the dialog, and a sample project will be created:
Step 2. Look around
When you launch CLion for the very first time, or when there are no open projects, you see the Welcome screen. It gives you the main entry points into the IDE: creating or opening a project, checking out a project from version control, viewing documentation, and configuring the IDE. When a project is opened, you see the main window divided into several logical areas. Let’s take a moment to see the key UI elements here:
- Project view on the left side displays your project files.
- Editor on the right side, where you actually write your code. It has tabs for easy navigation between open files
- Navigation bar above the editor additionally allows you to quickly run and debug your application as well as do basic VCS actions.
- Left gutter, the vertical stripe next to the editor, shows the breakpoints you have, and provides a convenient way to navigate through the code hierarchy like going to definition/declaration. It also shows line numbers and per-line VCS history.
- Right gutter, on the right side of the editor. CLion constantly monitors the quality of your code and always shows the results of its code analysis in the right gutter: errors, warnings, etc. The square in the top right-hand corner shows the overall status of code analysis for the whole file.
- Tool windows are specialized windows attached to the bottom and sides of the workspace and provide access to typical tasks such as project management, source code search and navigation, CMake information, integration with version control systems, etc.
- The status bar indicates the status of your project and the entire IDE, and shows various warnings and information messages like file encoding, line separator, inspection profile, etc. In addition, here you can find the Resolve Context chooser for switching between the Debug and Release contexts (with or without debug info) to resolve your code in the IDE with the desired definitions.
Step 3. Customize your environment
The first thing to fine-tune is the general "look and feel." Go to File | Settings | Appearance and Behavior | Appearance ( for OS X users) to select the IDE theme: the default light theme, or Darcula if you prefer a darker setting.
The many pages available under File | Settings | Editor ( for OS X users) help you adjust every aspect of the editor’s behavior. A lot of options are available here, from general settings (like Drag'n'Drop enabling, scrolling configuration, etc.), to color configuration for each available language and use case, to tabs and code folding settings, to code completion behavior and even postfix templates.
CLion uses the keyboard-centric approach, meaning that nearly all actions possible in the IDE are mapped to keyboard shortcuts.
The set of keyboard shortcuts you work with is one of your most intimate habits — your fingers "remember"
of keys, and changing this habit is easier said than done. CLion supplies you with a great default keymap (choose
on the main menu) making your coding really
productive and convenient. However, you can always change it by going to
File | Settings | Appearance and Behavior | Keymap (
for OS X users).
There are also some pre-defined keymaps (like Emacs, Visual Studio, Eclipse, NetBeans, or Xcode), and you can also create your own
keymap based on an existing one.
If you feel most productive with vi/Vim, an emulation mode will give you the best of both worlds. Simply enable the IdeaVim plugin in the IDE and select the vim keymap.
Step 4. Code with smart assistance
CLion takes care of the routine so that you can focus on the important. Use the following coding capabilities to create error-free applications without wasting precious time.
Code completion is a great time-saver, regardless of the type of file you’re working with. There are two types of code completion in CLion: basic (Ctrl+Space) and smart (Ctrl+Shift+Space). Basic completion works as you type and completes any name instantly. Smart completion analyzes the context you’re currently working in and offers more accurate suggestions based on that analysis. It filters the list of functions and variables to match the expression type:
CLion keeps an eye on what you are currently doing and makes smart suggestions, called intention actions, to save more of your time. Indicated with a lightbulb, intention actions let you apply automatic changes to code that is correct (in contrast to code inspections that provides quick-fixes for code that may be incorrect). Did you forget to add some parameters and field initializers to the constructor? Not a problem with CLion. Click the lightbulb (or press Alt+Enter) and select one of the suggested options: The full list of available intention actions can be found in or for OS X users.
Step 5. Keep your code neat
CLion monitors your code and tries to keep it accurate and clean. It detects potential errors and problems and suggests
Every time the IDE finds unused code, an endless loop, hidden upper scope, '=' in a conditional expression, and many other things that likely require your attention, you’ll see a lightbulb. Click it, or press Alt+Enter, to apply a fix: The complete list of available inspections can be found under (or for OS X users). You can disable some of them, or enable others, plus you can adjust the severity of each inspection. You decide whether it should be considered an error or just a warning.
Step 6. Generate some code
Writing code can be a lot easier and quicker when you use the code generation options available in CLion.
menu (Alt+Insert) will help you with constructor/destructor or getter/setter
generation, as well as suggest overriding/implementing some functions
Use live templates (choose or press Ctrl+J) to produce
entire code constructs. You can explore the
available ready-to-use live templates in the Settings dialog (Settings | Editor | Live templates or
if you are OS X user).
If you see that you are lacking
something especially important for your development, extend this set of templates with your own.
Also, consider quickly surrounding your code with complete constructs (choose or press Ctrl+Alt+T. For example, select an
and you will get:
Step 7. Find your way through
When your project is big, or when you have to work with someone else’s code, it’s vital to be able to quickly find what you are looking for and dig into the code. This is why CLion comes with a set of navigation features that will help you find your way through any code no matter how tangled it is.
To find where a particular symbol is used, CLion suggests full-scale search via Find Usages (Alt+F7): You also have the option to search only in the current file (Ctrl+F), or within a directory, any arbitrary scope, or the entire project (Ctrl+Shift+F).
You can tell a lot just looking at your File Structure, with its imports or call hierarchies, and possibly use it to navigate to:
- Class by its name (Ctrl+N).
- File by its name (Ctrl+Shift+N).
- Symbol by its name (Ctrl+Shift+Alt+N).
- Declaration (Ctrl+B).
- Base class/base function (Ctrl+U).
Navigate through the timeline
Remembering all your activity in the project, CLion can easily navigate you to the Recent Files (Ctrl+E) or Recently Changed Files (Shift+Alt+C). To go through the history of changes, try using Back/Forward navigation (Ctrl+Alt+Left/Ctrl+Alt+Right) and/or go to last edit location (Ctrl+Shift+Backspace).
Take advantage of many smart actions possible with CLion. For example, use the Find Action search (Ctrl+Shift+A): just type a part of the action name, and the IDE will show you the list of all available options. Then, select the action you need:
If you have a general idea of what you're looking for, you can always locate the corresponding element using one of the existing navigation features. But what if you really want to look for something in every nook and cranny? The answer is to use Search Everywhere! To try it, click the magnifying glass in the upper right-hand corner of the window, or invoke it with Double Shift (press Shift twice).
Step 8. CMake
The IDE takes all the information about your project from the CMake files: what files are included into the project, defines,
options, etc. Every change you make in CMakeLists.txt file is handled automatically by CLion, but you can also call Update CMake Project
manually from the CMake tool window. Note that when you build your application, the IDE calls CMake command,
so you don't need to do this step separately.
In CMake tool window, you can observe CMake problems and view/edit CMakeCache variables:
Step 9. Run and debug
Now when you’ve played with the code and discovered what you can do with it, it’s time to run your app. In CLion you do this via the Run/Debug Configurations. Open to see all the available options. For example, if you want to run some script before/after the build phase, you can do this easily by creating an external tool: To run a configuration, press Shift+F10.
Does your application stumble on a run-time error? To find out what’s causing it, you will have to do some debugging. CLion supports GDB debugger on all platforms and includes bundled GDB 7.8 (except for the Cygwin case on Windows), as well as LLDB on OS X bundled into the distribution package, which we recommend you to use. Debugging starts with placing breakpoints at which program execution will be suspended, so you can explore program data. Just click the left gutter of the line where you want the breakpoint to appear. To start debugging your application, press Shift+F9. Then go through the program execution step by step (see the available options in Run menu or in Debug tool window), evaluate any arbitrary expression, add watches and manually set values for the variables:
Step 10. Keep your source code under Version Control
If you are keeping your source code under version control, you will be glad to know that CLion integrates with many popular
version control systems: Git (or GitHub), Mercurial, Perforce, TFS, Subversion and CVS. To specify credentials and any settings
specific to a particular VCS, go to Settings | Current Project | Version Control (or
if you are OS X user).
The VCS menu will give you a clue about what commands are available. For example, you can see the changes you’ve made, commit them, create changelists and much more from the Changes view: (or just press N/A). Also some basic commands can be easily found in the Navigation bar above the editor:
In addition to traditional version control, you can use the local history. With Local History, CLion automatically tracks changes you make to the source code, the results of refactoring, etc. Local history is always enabled. To view it for a file or a folder, bring up Local History by selecting . Here you can review the changes, revert them or create a patch.
Step 11. That’s it! Go ahead and develop with pleasure!
We hope this brief overview of essential CLion features will give you a quick start. There are many important features that make
a developer’s life easier and more fun, and their source code neater and cleaner. Take these first few steps now, and then dig deeper
when you feel the time is right. Enjoy CLion!
With any questions please visit our CLion Discussion Forum, twitter and blog, where you can find news, updates, and useful tips and tricks. Also, don't hesitate to report any problems to our support team) or the CLion issue tracker.