For each target in your project (in case of CMake and Gradle projects), CLion generates a configuration that can be built and run, and allows you to configure external tools to run before/after the build phase in a separate UI dialog.
Use configuration templates to create configurations for unit testing, remote debug or regular application run.
You can change the executable for any configuration of your choice, or even make a configuration not runnable by changing this value to Not selected.
Build your project by pressing Ctrl+F9 and run the currently selected configuration with Shift+F10.
For debug press Shift+F9.
To help you inspect the state of your code during debugging, CLion equips you with many useful shortcuts like Step over/into (F8/F7), Step out (Shift+F8), or Run to cursor (Alt+F9).
Recompile a single file
To speed up your development cycles in CLion when working with CMake or compilation database projects, use Recompile (Shift+Ctrl+F9). It reruns the compilation for a selected file, without triggering the recompilation of the whole project.
Debug/Release build types
When CMake is used, switch between CMake profiles (and built types) in the run configuration switcher on the toolbar or in the Run (Shift+Alt+F10)/Debug (Shift+Alt+F9) configuration switcher popup.
CLion uses PTY as an I/O unit, which means that you can expect a behavior similar to running your project in a terminal, even on Windows.
Develop remotely from a Windows, Linux, or macOS client machine to a Linux remote host, for CMake-based projects only. The current setup assumes the source code is located on a local machine, which CLion synchronizes to the remote machine.
To start developing remotely, create a remote toolchain in Settings | Build, Execution, Deployment | Toolchains. Provide the remote host address and credentials, and then use the toolchain in one or several CMake Profiles. After CMake is reloaded, you’ll be ready to start working remotely with your project in CLion.
CLion integrates with the GDB backend on all platforms and LLDB on macOS and Linux.
Attach to local process
CLion allows you to debug processes, run on the same machine but not started from the IDE, by attaching to them using their pid or process name. Benefit from CLion’s built-in debugger UI for local processes with GDB on Linux/Windows and LLDB on macOS/Linux.
Remote GDB debug
Having executable running on one machine under gdbserver, you can connect to it with the GDB from CLion from another machine and inspect the code using all the benefits of CLion’s debugger UI.
Use special GDB Remote Debug configuration template to provide settings for the remote connection.
CLion includes an integrated debugger to help you inspect your code’s execution. You can select among several types of breakpoints in CLion (all the breakpoints can be reviewed in a separate dialog (available via Ctrl+Shift+F8)):
- Line breakpoints are the easiest way to debug your code. Simply set a breakpoint with the mouse by clicking in the left-hand gutter of a line.
- Symbolic breakpoints help you stop program execution when a specific function starts executing. Find a symbol by its name, taking advantage of code completion, to go to the appropriate function.
- Exception breakpoints help catch any thrown exception without any extra hassle.
Watches and evaluations
The description of all available variables, including STL containers content will be placed in Variables tab in Debug tool window. There you can observe and even change any value without interrupting current debug session:
GDB/LLDB tab provides access to GDB/LLDB console, while Frame and Watches views help investigate any problem in more detail. As a bonus, when selecting a symbol to watch you can benefit from autocompletion.
In addition, you can evaluate any expression during a debugging session, simply by pressing Alt+F8.
Inline variable view
With this feature you can view current variable values right in the editor (next to the variable declaration). No need to switch to the Variables tab in the Debug tool window!
When sources are not available, step into disassembly code. Read the assembly, which is properly highlighted in the editor, and step through it to investigate the problem.
To get into disassembly code, use Force Step Into (Shift+Alt+F7). The usual Step Into (F7) will simply skip all frames without sources.
Supported for GDB only.Learn more