clion

Clion code formatting to align variables

☆樱花仙子☆ 提交于 2019-12-06 01:57:25
Is it possible to change the options in Clion so that the variables are aligned like so: This should be applied in structs and methods. Yes. Settings -> Editor -> Code Style -> C/C++ -> Wrapping and Braces -> Variable groups -> Align in columns You can of course also use a custom formatting tool that does it as well. 来源: https://stackoverflow.com/questions/35550885/clion-code-formatting-to-align-variables

Is it possible to have cmake build file (CMakeLists.txt) not in root in CLion

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 01:47:22
问题 Is it possible to have cmake build file (CMakeLists.txt) not in root directory in CLion? I am currently working on project where cmake build file is not in not in the root directory of a CLion project (in out/Debug directory). I want CLion to open root of this project, and use cmake from out/Debug. Is is possible? EXAMPLE: |- main.cpp |- classs.cpp |- class.h |- build1 |- CMakeLists.txt |- build2 |- CMakeLists.txt This is a little bit unusual, but think of situation when cmake file is

Hide automatically generated CTest targets

混江龙づ霸主 提交于 2019-12-05 21:57:14
I'm using CMake and CTest in CLion. Annoyingly, CTest generates a load of targets that I don't care about: Continuous ContinuousBuild ContinuousConfigure ContinuousCoverage ContinuousMemCheck ContinuousStart ContinuousSubmit ContinuousTest ContinuousUpdate Experimental ExperimentalBuild ExperimentalConfigure ExperimentalCoverage ExperimentalMemCheck ExperimentalStart ExperimentalSubmit ExperimentalTest ExperimentalUpdate Nightly NightlyBuild NightlyConfigure NightlyCoverage NightlyMemCheck NightlyStart NightlySubmit NightlyTest NightlyUpdate These all show up in CLion. Quite annoying as I'm

CLion build depend targets

ⅰ亾dé卋堺 提交于 2019-12-05 10:07:35
My CLions CMakeLists.txt contains more than 1 target (libraries and depends executables). How can I configure building all targets in one click, instead of choosing target one by one and building them? For example, in Visual Studio I can configure project dependencies and build all solution. CLions "Edit configurations..."->"Before launch:Build" won't work for me. You can add the command add_dependencies to your CMakeLists.txt , it does what you want: Make a top-level target depend on other top-level targets to ensure that they build before does. Then you just need to create a "BUILD_ALL"

How to enable all compiler warnings in CLion?

不羁岁月 提交于 2019-12-05 05:15:29
I want to see all compiler warnings in CLion. I don't want them treated as errors, but I want to inspect all of them. How can I do this? Gluttton Try to set compiler flag in CMakeLists.txt : set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") Related question: How to enable C++11 in CLion? Rebuild your entire project. Most compilers don't rebuild every file when you just press build, so you will only see warnings from files that were changed. For C: set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") 来源: https://stackoverflow.com/questions/31790467/how-to-enable-all-compiler-warnings-in

Accessing anything GLEW related immediately crashes program in MinGW

廉价感情. 提交于 2019-12-05 02:46:21
问题 Here is the code: #define GLEW_STATIC #include "GL/glew.h" int main () { glewExperimental = GL_TRUE; return 0; } Here is the output: Process finished with exit code -1073741515 (0xC0000135) When the 'glewExperimental' line is commented out, program exits with 0. Here is the CMake file (I am using CLion): cmake_minimum_required(VERSION 2.8.4) project(untitled) add_definitions(-DGL_GLEXT_PROTOTYPES) add_definitions(-DWINVER=0x0602) add_definitions(-D_WIN32_WINNT=0x0602) set(CMAKE_CXX_FLAGS "$

Defining preprocessor symbols for CLion analyzer

我的未来我决定 提交于 2019-12-04 23:53:37
In my project there's a file enclosed in an ifdef preprocessor directive #ifdef SOME_SYMBOL ... entire file ... #endif SOME_SYMBOL is defined by another file that's compiled before this one, and the code works as expected, but the static analyzer isn't aware of this symbol and so it treats SOME_SYMBOL is undefined. The entire file has no syntax highlighting and some of the analysis is just skipped (e.g. syntax error highlighting). Is there a way to tell the analyzer to treat this symbol as defined without defining it in CMakeLists.txt? I don't have the option of defining SOME_SYMBOL in

How to change include dirs, library dirs and libraries with CLion

半世苍凉 提交于 2019-12-04 17:07:32
问题 In CLion, how can I specify the include directories where the C++ compiler will look for header files? Also, how do I setup the libraries to link against, and their library directories? Currently I'm doing those tasks modifying directly the file CMakeLists.txt : include_directories(/opt/netcdf/include) link_directories(/opt/netcdf/lib) link_libraries(netcdf) But I wonder if it is possible to accomplish the same thing using the GUI. Thanks 回答1: In CLion, the CMakeLists.txt file(s) for your

CMake not linking Python

荒凉一梦 提交于 2019-12-04 16:19:36
Sorry if I'm duplicating a question, but I just cannot find the solution to what I'm looking for anywhere on the internet, yet I believe that this is a very simple problem. I'm trying to extend python with some custom C++ libraries, and building my C++ libraries with CMake. I'm following the instructions on https://docs.python.org/2/extending/extending.html , but it's not compiling correctly. When I try to build it, I get these messages: "C:\Program Files (x86)\JetBrains\CLion 140.2310.6\bin\cmake\bin\cmake.exe" --build C:\Users\pkim2\.clion10\system\cmake\generated\76c451cd\76c451cd\Debug -

CLion disable C++98 mode in favour of C++11

大兔子大兔子 提交于 2019-12-04 13:26:45
问题 I'm trying to compile some code using C++11 only syntax in JetBrains CLion, so I wish to disable C++98 mode. I followed the instructions accordance of this StackOverflow question, but am unable to get it working. In order to achieve this goal, I went to ALT + SHIFT + F10 and passed the argument -std=c++11 in Program Arguments . Upon building again, C++98 mode still seems to be enabled. /cygdrive/c/Users/Zarthus/Documents/test/command.cpp: In constructor 'Command::Command(std::vector<std: