clion

Add external c++ libraries to a CLion project

a 夏天 提交于 2020-01-03 10:06:41
问题 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? 回答1: Manually edit CMakeLists.txt adding the following lines at the end with the proper paths for your system and proper ProjectName. This config is for an Ubuntu 17.04 workstation. include_directories("/usr/include/SDL2") target_link_libraries(ProjectName "/usr/lib/x86_64-linux-gnu/libSDL.so") Hope this helps. You can test it

How to properly include Armadillo in CLion (without having false errors)?

无人久伴 提交于 2020-01-03 09:30:00
问题 When I use the header-only Armadillo C++ library in CLion, the IDE indicates (highlights) multiple (false) errors in the code, however the usage of Armadillo is valid and the code builds and runs without any errors. For example, in a very simple Armadillo test project, the IDE indicates 3 errors, as written in the comments: #include <iostream> #include "armadillo" using namespace std; using namespace arma; int main() { cout << "Armadillo version: " << arma_version::as_string() << endl; //

Undefined Qt5 references in C++ using CMake (mingw) in Windows with CLion

北慕城南 提交于 2020-01-02 15:40:51
问题 I am trying to learn Qt5 with CMake in the new CLion C/C++ IDE, I am relatively new with these tools. So, I have this real simple code main.cpp : #include <QDebug> int main() { qDebug("Hello World!"); return 0; } I've followed the documentation and ended with this CMakeLists.txt : cmake_minimum_required(VERSION 2.8.11) project(cl_hello_world2) set(CMAKE_PREFIX_PATH D:/Qt/Qt5.4.0/5.4/msvc2012_opengl) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS

Undefined Qt5 references in C++ using CMake (mingw) in Windows with CLion

与世无争的帅哥 提交于 2020-01-02 15:39:05
问题 I am trying to learn Qt5 with CMake in the new CLion C/C++ IDE, I am relatively new with these tools. So, I have this real simple code main.cpp : #include <QDebug> int main() { qDebug("Hello World!"); return 0; } I've followed the documentation and ended with this CMakeLists.txt : cmake_minimum_required(VERSION 2.8.11) project(cl_hello_world2) set(CMAKE_PREFIX_PATH D:/Qt/Qt5.4.0/5.4/msvc2012_opengl) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS

Pythonlibs3 CMake and macOS

北慕城南 提交于 2020-01-01 13:28:38
问题 [UPDATE 2] The following two lines, when added to my CMake file, successfully found python 3 and its libraries. The reason this was only working in the terminal was because CLion was using its bundled version of CMake (3.6.3) and the updated version my terminal was using (3.7.2) correctly finds python. FIND_PACKAGE(PythonInterp 3) FIND_PACKAGE(PythonLibs 3) [UPDATE] I got the cmake file to work, however, it only finds the python3 library when I run from the terminal. When running from CLion,

Linking SDL2 and Clion

时光怂恿深爱的人放手 提交于 2019-12-31 01:46:21
问题 I have clion pointing to SDL2 directories and libs, but it fails to link the libraries when I try to build. Any ideas on how to fix this? CMakeLists: cmake_minimum_required(VERSION 3.3) project(cavestory_development) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror -lSDL2") set(SDL2_INCLUDE_DIR C:/SDL2-2.0.3/i686-w64-mingw32/include/SDL2) set(SDL2_LIBRARY C:/SDL2-2.0.3/i686-w64-mingw32/lib) find_package(SDL2 REQUIRED) include_directories(${SDL2_INCLUDE_DIR}) set(SOURCE_FILES main.cpp) add

Building wxWidgets 3.1.0 on CLion (Ubuntu)

允我心安 提交于 2019-12-31 00:42:07
问题 I am currently trying to build wxWidgets-3.1.0 on a CLion 1.3 project. I use Ubuntu 16.04 (64 bit). Basically, I edited the CMakeLists.txt file like this: cmake_minimum_required(VERSION 3.5) project(WxProva) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH}) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(SOURCE_FILES main.cpp) add_executable(WxProva ${SOURCE_FILES}) find_package(wxWidgets) include_directories(${wxWidgets_INCLUDE_DIRS}) target_link

CLion配置Cygwin环境

梦想与她 提交于 2019-12-30 21:25:15
CLion "download" 跳转到 https://cygwin.com/install.html 下载64位安装程序并安装 国内添加网易镜像 http://mirrors.163.com/cygwin/ 接下来选择安装的模块,skip是选择安装的版本的按钮,所要选择的安装模块都在devel下 如果是 c/c++ 的环境。 可以直接搜索gcc-core、gcc-g++、make、gdb、binutils,cmake 这几个是必须要下载的。 注意还需要将你的cgwin的安装目录中的bin导入到path中,具体的步骤,我的电脑然后属性->高级系统设置->环境变量 然后编辑系统变量中的path 然后新建,然后输入你cygwin的路径就可以 例如E:\cygwin64\bin 安装好了以后,就需要在clion中选择这个cygwin编译器 环境的配置: 这个选择左上角的file 然后选择setting 选择cygwin home dir 为 C:/cygwin64 来源: https://www.cnblogs.com/ZeroTensor/p/11185351.html

Boost not Linking properly using CMake on Ubuntu

泄露秘密 提交于 2019-12-29 08:26:31
问题 I've tried to make the code as simple as possible and I'm still getting undefined reference to `boost::log::v2_mt_posix:: . . . etc. This is driving me crazy, so I'm posting my code: CMakeLists.txt cmake_minimum_required(VERSION 3.1) project(BoostTest) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread -DBOOST_LOG_DYN_LINK") set(SOURCE_FILES Logger.cpp Logger.h loggertest.cpp) set(BOOST_ROOT /usr/local) find_package(Boost 1.57.0 COMPONENTS log thread system REQUIRED) include

Unable to include SFML header files in CLion project

蓝咒 提交于 2019-12-26 01:31:53
问题 I'm quite new to CMake and C++ in general, so today I've tried to import an external library like SFML to my project in Jetbrain's IDE CLion, but without any luck. After spending a whole day learning about CMake in general and making SFML work with CMake in particular, I've finally managed my project's CMake to find the SFML library files. However, when I approached a header file of my own to include a SFML header, I encountered a problem as it didn't find any headers from the library - And