Before starting with CLion, check these system requirements.
Configure and use different toolchains for different projects in CLion, or even inside one project for different configurations.
You can change CMake executable, Make, C and C++ compilers and debugger. Note that you can use either bundled or custom version of CMake and debugger executable.
Windows Subsystem for Linux
On Windows use WSL toolchain. Compile, run, and debug Linux binaries while working on Windows. Test targets under Valgrind Memcheck to detect possible errors and leaks.
Microsoft Visual C++ compiler
CLion supports and auto-detects Microsoft Visual C++ compiler from Visual Studio 2013, 2015 and 2017. CMake project is still required (it will be used along with the NMake generator).
Debugger is not supported in this case.
CMake profiles describe the set of settings used when CMake is run for the current project: build type (Release, Debug, etc.), toolchain, CMake options, environment parameters, CMake generation path and CMake build options.
Switch between CMake profiles in the run configuration switcher on the toolbar or in the Run (Shift+Alt+F10)/Debug (Shift+Alt+F9) configuration switcher popup.
Start a new project
To start a completely new project, use
File | New Project... to generate the sample project and pre-fill root CMakeLists.txt with the necessary information:
To check system requirements and get started with CLion, refer to the Quick Start Guide.
Open an existing project
To start working with an existing CMake project in CLion, locate the root CMakeLists.txt file, CMakeCache.txt file or CMake generation directory (the last two options work only for Makefiles generator).
Alternatively (if you don't have a CMake-based project), import a C/C++ project from an existing source, and CLion will create CMakeLists.txt for you.
Another option is to check out source code from an existing VCS storage or repository. Git, GitHub, CVS, Mercurial, Subversion, TFS and Perforce are supported.
Add new files
New files can be added to the project by using the New menu. In the Project tree view, press Alt+Insert or select New in the context menu.
- Click C++ Class to generate a .cpp file source file with a header and a class stub:
- Click C/C++ Source File to generate a simple source file, optionally with an associated header.
- Click C/C++ Header File to generate a simple header file.
Update CMake targets
In all three cases you can also select the CMake targets in which the files need to be included, and CLion will automatically update the appropriate CMakeLists.txt in your project:
File extensions can be configured in
Editor | Code Style | C/C++ | New
File Extensions settings. These file extensions are available when creating a new C++ class,
or header file. Reorder the list of possible combinations to have your favorite one on top
and to use it as the default.
While CLion requires a CMake project to provide smart IDE features, you can open a single file or folder in CLion which don’t have to be connected to any CMake project. Follow the built-in notification to select and load a CMakeLists.txt file later.