Easy start

Before starting with CLion, check this Quick Start Guide.

Configure toolchains

Configure and use different toolchains for different projects in CLion, or even inside one project for different configurations.

Toolchains

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.

On Linux and macOS you can use GCC or Clang as a compiler, on Windows – you can select between MinGW-w64, MinGW, Cygwin, Clang-cl and MSVC (see below), or configure a System toolchain without selecting a predefined environment. You can also use the IAR compiler on Linux and Windows.

Use Remote toolchains for building, running and debugging on a remote host.

Windows Subsystem for Linux

WSL

On Windows use WSL/WSL2 toolchains. Compile, run, and debug Linux binaries while working on Windows. Test targets under Valgrind Memcheck to detect possible errors and leaks.

Learn more

Microsoft Visual C++ toolchain

MSVC

CLion supports and auto-detects Microsoft Visual C++ toolchain from Visual Studio 2013, 2015, 2017, and 2019.

To use Clang-cl instead of MSVC, select the Visual Studio toolchain in CLion and point to clang-cl.exe in the toolchain settings (versions 8.0 and later are supported).

The LLDB-based debugger for the Visual Studio C++ toolchain developed by JetBrains is a default debugger for this toolchain. To enable bundled support for native visualizers, use Settings | Build, Execution, Deployment | Debugger Data Views | Enable NatVis renderers for LLDB.

Learn more

Single file

Single File

If you have just one or two C++ files that you write code in and then want to compile and run, you don't need CMake or another project model to open them in CLion. There is an option to compile and run a single C or C++ file.

C/C++ File run/debug configuration type allows you to quickly configure the toolchain, source files, and compilation options. When created, it allows you to compile and run the selected files.

Project models

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

Project models

CLion supports:

For all four CLion provides full code insight.

For CMake you can enable various CMake generators (Ninja, Xcode, Visual Studio, etc.).

Start a new project

Settings

To start a completely new project, use File | New Project... to generate the sample project. For C and C++ CLion will create a CMake project and pre-fill root CMakeLists.txt with the necessary information.

Open an existing project

To start with an existing project in CLion, select one of the following options:

  • For CMake project: locate the root CMakeLists.txt file, CMakeCache.txt file or CMake generation directory (the last two options work only for Makefiles generator).
  • For Gradle C++: open the build.gradle file from the project sources.
  • For compilation database: use the compile_commands.json file (see this list of ways to get a compilation database for your project).
  • For other project models: open a single file or a folder with C/C++ sources in CLion, mind the code insight will be limited in this case.
  • Alternatively, import a C/C++ project from an existing source, and CLion will create CMakeLists.txt for you.

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.