How to clear CMake cache in Clion?

Starting with CLion 1.5 144.3143 (2016-01-20), you can clear the cmake cache without loosing the CLion indexes and without restarting (meaning: very fast, also on huge projects): Tool | CMake | “Reset cache and reload project”. If that for some reasons is not enough, or if you have an older CLion, you can do the … Read more

Setup Google test in CLion

Create new Project Create a repository in my ClionProjects folder cd ~/ClionProjects mkdir .repo cd .repo Clone the DownloadProject from github git clone https://github.com/Crascit/DownloadProject.git Create a C++ project with a src and test directory Add following files: CMakeLists.txt cmake_minimum_required(VERSION 3.3) project(MyProjectName) add_subdirectory(src) add_subdirectory(test) src/CMakeLists.txt #set(core_SRCS ADD ALL SOURCE FILES HERE) add_library(core ${core_SRCS}) add_executable(exe main.cpp) target_link_libraries(exe … Read more

Using clang-format in CLion

You can use External Tools in CLion. Go to File->Settings->Tools->External Tools and click on the plus sign. A window should pop up. Use a name of your choice. For the Tool settings tab I’m using this configuration: Program: clang-format-3.7 (you should use the name of your executable here) Parameters: -i $FileName$ Working directory: $FileDir$ Now, … Read more

Where does CLion store executable files?

When you build under CLion, It prints the path it sends the executable to the Console: — Build files have been written to: /home/<user>/.clion10/system/cmake/generated/8bd932b1/8bd932b1/Debug1 To change this File > Settings…, and under CMake settings, enter the desired subdirectory name (e.g., ‘bin’) in the Working directory field: (You may require Run > Clean before the new … Read more

How to create a C project with CLion

From the CMake file you provided, you can simply delete the CMAKE_CXX_FLAGS line, or perhaps replace it with a C one like this: set(CMAKE_C_FLAGS “${CMAKE_C_FLAGS} -Wall -Werror”) The rest of it should be fine, apart from renaming main.cpp to main.c as you said.

“Use of a signed integer operand with a binary bitwise operator” – when using unsigned short

The code for this warning checks if either operand to the bitwise operator is signed. It is not sequence causing the warning, but 14, and you can alleviate the problem by making 14 unsigned by appending a u to the end. (sequence >> 14u) This warning is bad. As Roland’s answer describes, CLion is fixing … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)