clion

CLion报错解决:allocating an object of abstract class type--unimplemented pure virtual method

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 13:59:33
在用CLion写代码时遇到了这个报错: allocating an object of abstract class type '...' unimplemented pure virtual method '...' in '...' 这个报错的意思是派生类有没有实现的虚函数,所以是抽象类。 我感觉这个报错有问题,因为我的派生类已经实现了父类的虚函数。 然后我想到一件事:在函数后加上关键字 override 表示重载。 在加上关键字 override 后,clion报错了。 我仔细观察,发现是因为参数中没有 & !!! 来源: https://blog.csdn.net/zhangpeterx/article/details/98881520

How do I set up CLion to compile and run?

允我心安 提交于 2019-11-26 11:52:58
问题 I just downloaded CLion from https://www.jetbrains.com/ because I just love the rest of their products. However I\'m having problems configuring it. I\'m not able to compile and run my application (a simple \"hello world\"). When I try to run the application it refers me to \"Edit configuration\", so I added a new application and now I have this problem: I cannot specify the \"target\"; the only thing I can do is set \"All targets\". I cannot specify the \"configuration\" (all tutorials I

How to enable C++11 in CLion?

我的未来我决定 提交于 2019-11-26 09:51:36
问题 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 but I still have the same problem. Regular C++ code compiles fine. What flag do I have to set in CLion\'s CMake window to compile my C++11 code? 回答1: I tried to set CMAKE_C_FLAGS According to the documentation the CMAKE_C_FLAGS set C language flags

How to add “-l” (ell) compiler flag in CMake

时光总嘲笑我的痴心妄想 提交于 2019-11-25 22:36:03
问题 Work on Ubuntu 16 I used g++ main.cpp -lpq command for compiler my small project. Now I use Clion and wanna do same what I do with g++ . But I can\'t add compiler flags in cmake file and get compile error. cmake_minimum_required(VERSION 3.5.1) project(day_g) set(CMAKE_CXX_FLAGS \"-lpq\") add_definitions(-lpq) message(\"CMAKE_CXX_FLAGS is ${CMAKE_CXX_FLAGS}\") set(CMAKE_CXX_STANDARD 11) set(SOURCE_FILES main.cpp) add_executable(day_g ${SOURCE_FILES}) Also I run only cmake file and get CMAKE