clion

Error linking Boost with CMake

▼魔方 西西 提交于 2019-11-29 16:21:17
I am using CLion on OS X 10.10.5 (Yosemite) and trying to use the logging boost (1.58.0) library. I installed boost using brew install boost . I checked that the boost libraries are 64-bit and so is my executable. My CMakeLists.txt looks like this: set(CMAKE_VERBOSE_MAKEFILE on) cmake_minimum_required(VERSION 3.3) project(gmch) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") set(Boost_USE_MULTITHREADED ON) find_package(Boost 1.58.0 COMPONENTS log REQUIRED) include_directories(${Boost_INCLUDE_DIR}) set(SOURCE_FILES main.cpp util/timing.hpp) add_executable(gmch ${SOURCE_FILES}) target_link

use OpenCV with Clion IDE on Windows

本秂侑毒 提交于 2019-11-29 14:26:19
问题 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 3.3) project(test) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") include_directories("C:\\opencv\\build\\include\\") FIND_PACKAGE( OpenCV REQUIRED core highgui imgproc) set(OpenCV_FOUND TRUE) set(SOURCE_FILES main.cpp) add_executable(prog ${SOURCE_FILES})

How to add prebuilt static library in project using CMake?

╄→гoц情女王★ 提交于 2019-11-29 13:24:48
Clion: how add or (use) prebuilt static library in my Project? You're probably asking about how to link your project to the pre-built static library. If so, you can do like this by calling target_link_libraries . Assume your project called myProj and the pre-built library myLib.lib , you can do like this: target_link_libraries(myProj myLib) I had great difficulty making this work as I was completely new to CLion and CMake. In my scenario I was taking a class that required us to use the course library in every project. Assuming you have a library called libClassLibrary.a , do the following in

Boost not Linking properly using CMake on Ubuntu

情到浓时终转凉″ 提交于 2019-11-29 12:55:09
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_directories(${Boost_INCLUDE_DIRS}) add_executable(BoostTest ${SOURCE_FILES}) target_link_libraries(BoostTest $

Clion or cmake does not see environment variable

[亡魂溺海] 提交于 2019-11-29 09:26:00
I'm using CLion IDE, Cmake and trying to write Hello world using CERN ROOT library. CMakeLists.txt : message(STATUS $ENV{ROOTSYS}) ~/.bashrc : export ROOTSYS="$HOME/tools/root-build/" During build in CLion $ENV{ROOTSYS} is empty by some reason. But $ENV{PATH} returns correct $PATH . What I did wrong? From CLion developers FAQ : Q: How to pass environment variables and parameters to CMake in CLion? A: The best way is to use Preferences/Settings | Build, Execution, Deployment | CMake dialog. As for .bashrc file, it is only used by bash . CLion doesn't need to use bash for run configuration

Enable code indexing of Cuda in Clion

拥有回忆 提交于 2019-11-29 09:18:40
问题 I am using Clion to develop a cuda program. The code highlight works fine when the extension is .h. However, when it is changed to .cuh, Clion just consider the new file a plain text file, and I have not been able to enable code highlight. I understand a complete Cuda toolchain is out of the question, so I will not hope Clion to parse statements like mykernel<<<1024, 100>>>. Still I will be more than satisfied if it can parse the file just like parsing a normal header/cpp file. Many thanks

Including directories in Clion

隐身守侯 提交于 2019-11-29 07:12:00
Whenever I wanted to include a directory that was located outside of my project with Clion I would use the -I somedir flag. This time however, what I want to do is to have a hierarchy like this: /project CMakeLists.txt /src /Graph Graph.h Graph.cpp /Dijkstra Dijkstra.h Dijstra.cpp I want my code in a /src directory. And not only that, but also, for example, inside the file Dijkstra.h I want to include the Graph.h like this: #include "Graph/Graph.h and not like this: #include "../Graph/Graph.h . If I only add an -I src flag, then if I am inside the Dijkstra.h file and I wanted to include Graph

Change default CMakeLists.txt in CLion to include warnings

独自空忆成欢 提交于 2019-11-29 07:11:59
In CLion the default CMakeLists.txt sets the C++11 compiler flag only. I'd like to have warnings and the pedantic flag by default in all my projects. This is by default set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") and I'd like to have this by default so I don't have to change it every time I create a new project set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -W -Wall -Wextra -pedantic") In the "Settings" - "File and Code Templates" I can change the C++ header/source template but not the CMakeLists.txt template. Is there any way I can change the default CMakeLists.txt template in

clion makefile

。_饼干妹妹 提交于 2019-11-29 06:41:25
clion 编译和调试原来的makefile编译的工程,可以参考这个办法 https://www.jetbrains.com/help/clion/custom-build-targets.html#custom-rundebug 来源: https://blog.csdn.net/weixin_41688322/article/details/100544177

CLion C++ can't read/open .txt file in project directory

岁酱吖の 提交于 2019-11-29 04:02:30
I have a .txt file in my project directory that I made and populated with data. directory structure looks like: /Users/asd/ClionProjects/ProjectWithTemplates/ main.cpp cmake twoday.txt here is my code: #include <iostream> #include <array> #include <cmath> #include <fstream> using namespace std; /* print array prototype */ template <size_t N> void printArray(const array<double , N> & arr); /* mean function prototype */ template <size_t N> double meanArray(const array<double , N> & arr); /* standard deviation prototype */ template <size_t N> double sDeviation(const array<double , N> & arr); int