Questions tagged [clion]

CLion is a cross-platform IDE for C and C++ development.

CLion is a cross-platform C/C++ IDE from JetBrains (you can run it on Linux, Windows and macOS). It natively supports old and new C/C++ language standards, Boost and libc++ libraries, and works with templated code and macros. CLion helps you instantly navigate and refactor your code, with Rename refactoring, Change Signature, Inline, Extract Function / Variable / Constant / Parameter, and others. Code analysis (including Data Flow Analysis and Clang-Tidy) is running while you are typing to ensure code quality.

CLion uses CMake as a project model and handles your changes in CMake files automatically, using all the information from there during code editing and refactorings.

Apart from CMake, CLion supports compilation database and Gradle projects. Currently, you cannot create a new project of these types within CLion, but you can open and manage an existing one with full code insight available.

CLion will enrich your development with an integrated debugger (GDB and LLDB), Doxygen support, various unit testing frameworks, Version Control Systems, and dozens of plugins from the repository to extend its functionality.

Besides C and C++, CLion comes with Python, HTML, JavaScript, Swift Kotlin/Native and some other languages support included.

CLion’s functionality can be extended via IntelliJ Platform API.

Useful links

2813 questions
24
votes
17 answers

Why are my breakpoints not hit in CLion?

I'm trying to debug an executable which has been created with CMake configuration SET(CMAKE_BUILD_TYPE Debug) However, CLion does not hit any breakpoints. What could be the problem?
mstrap
  • 16,808
  • 10
  • 56
  • 86
24
votes
6 answers

In CLion, how can I rename a project?

I try to rename my project from encoding to Tutorial, but after I refactor directory name, it comes out an error, like: Error: CMakeLists.txt not found in D:\code\encoding I find that files in .idea directory don't change automatically, they are…
anjouslava
  • 251
  • 1
  • 2
  • 7
22
votes
2 answers

Add external c++ libraries to a CLion project

I am using CLion from Mac, and i'm having problems to understand how can i add external libraries to my project. So, how can i add external libraries to a c++ project?
PazzoTotale
  • 411
  • 2
  • 5
  • 14
22
votes
1 answer

How to run CLion with msys2 on windows

How to run clion with msys2 on windows? I have set the toolchain, but when it can't find .
user5946389
22
votes
1 answer

How to make CLion use "#pragma once" instead of "ifndef ... def ..." by default for new header files?

By default, CLion will add the following lines to a newly created header file: #ifndef SOME_NAME_H #define SOME_NAME_H .... your code here #endif //SOME_NAME_H But I like #pragma once more. How can I configure CLion so that it uses #pragma once by…
a06e
  • 18,594
  • 33
  • 93
  • 169
21
votes
1 answer

CLion formatting of pointer/references

From reformatting, I want: int* n; int& m; int const* o; instead, I get: int *n; int &m; int const *o; How to make CLion do what I want?
hamster on wheels
  • 2,771
  • 17
  • 50
21
votes
3 answers

Is there a way to work on multiple projects in CLion?

I'm looking for a way to work on multiple projects in parallel in CLion IDE. For now I can only work on each project in a window at a time, but I'm looking for a solution similar to Eclipse IDE (see below) - being able to see my different projects'…
noamgot
  • 3,962
  • 4
  • 24
  • 44
20
votes
3 answers

How do I get CLion to run an install target

I'm evaluating CLion 1.2.1 on an existing project which is already using CMake. The project is made up of a few library modules and a single executable. I have an install target which I use to collect the executable and a configuration file…
BahmanR
  • 203
  • 1
  • 2
  • 4
20
votes
5 answers

When compiling in clion I get the error "executable is not specified"

I'm using MacOS and trying to write c++ code in Clion but when I run the simple hello world code I get the error executable is not specified. I'm new to Clion. Cmakelist.txt cmake_minimum_required(VERSION 3.2) project(untitled) set(CMAKE_CXX_FLAGS…
user4134614
20
votes
3 answers

Exclude directories from indexing in CLion

How do I exclude directories from being indexed in CLion? I have several GB of data being indexed that are slowing everything down. In PyCharm I can just right-click on the directory, but I don't find this option on CLion. To be more concrete, I…
Jorge Leitao
  • 19,085
  • 19
  • 85
  • 121
20
votes
2 answers

How to enable C++11 in CLion?

I'm trying to run C++11 code in CLion but it doesn't work. It says: ... /projects/CLion/untitled/main.cpp:7:1: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11 ... I tried to set CMAKE_C_FLAGS to -std=c++11 or -std=gnu++11…
Pavel
  • 4,912
  • 7
  • 49
  • 69
19
votes
2 answers

Const-qualification of parameters in function declaration

I have the following function declaration in a header file: extern void flash(const char *message, const enum msg_type type); Basically, it takes two parameters and pushes a corresponding message into a global message queue. Since it doesn't need…
nalzok
  • 14,965
  • 21
  • 72
  • 139
19
votes
0 answers

Syntax highlighting for Lex files in CLion

Is it possible to get syntax highlighting for Lex files in CLion? I could not find a suitable plugin. I am using the Lex files to learn flex and bison.
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
19
votes
3 answers

sending EOF to stdin in Clion IDE

Is there a way to send EOF to stdin when running a c program in Clion IDE? I tried ctrl+D - it simply shuts the program down. Ctrl+Z doesn't work either. Any ideas? BTW - I'm using it on a Windows 10 OS.
noamgot
  • 3,962
  • 4
  • 24
  • 44
19
votes
2 answers

use OpenCV with Clion IDE on Windows

I'm actually looking for a way to create apps with OpenCV with Clion from JetBrains. I've installed OpenCV with Choco, so I have all the stuff in C:\opencv this is my projet with Clion CMakeLists.txt: cmake_minimum_required(VERSION…
miton18
  • 253
  • 1
  • 2
  • 8