[英]How to build my project with Clion Remote?
I successfully set up a remote project in CLion.我在 CLion 中成功设置了一个远程项目。 It recognizes the compiler and everything on the remote host and also synchronizes changes.
它识别编译器和远程主机上的所有内容,并同步更改。
Now to my problem:现在我的问题:
When I try to build and run the project it gives me an error that it can't find a certain lib:当我尝试构建和运行项目时,它给了我一个错误,它找不到某个库:
fatal error: Eigen/SparseCore: No such file or directory
#include <Eigen/SparseCore>
But when I log into the server via ssh I can go to the synced directory, run make and it compiles with no errors.但是当我通过 ssh 登录服务器时,我可以 go 到同步目录,运行 make 并且编译没有错误。 I can then run the compiled app no problem.
然后我可以运行编译的应用程序没有问题。
Here's the CMakeLists.txt:这是 CMakeLists.txt:
cmake_minimum_required(VERSION 3.10)
project(projectName)
set(CMAKE_CXX_STANDARD 14)
include_directories(/usr/local/PRIV)
include_directories(/usr/local/PRIV/Includes)
include_directories(/usr/local/PRIV/Includes/SubDir)
include_directories(/usr/local/PRIV/Includes/SubDir/eigen3)
include_directories(/usr/local/PRIV/Includes/SubDir/eigen3/Eigen/)
include_directories(/usr/local/PRIV/Includes/SubDir/qhull)
add_executable(
Example/MyTopTen/Makefile
Example/MyTopTen/MyTopTen.cc
Example/MyTopTen/MyTopTen.h
Example/MyTopTen/Readme.txt
Example/Makefile
Example/Example.cc
)
I'm very new to cmake projects and Stackoverflow so if I can improve this question just let me know!我对 cmake 项目和 Stackoverflow 非常陌生,所以如果我能改进这个问题,请告诉我!
Please follow Eigen guide how to use it with CMake https://eigen.tuxfamily.org/dox/TopicCMakeGuide.html请按照 Eigen 指南如何将其与 CMake https://eigen.tuxfamily.org/dox/TopicCMakeGuide.html 一起使用
In this case your CMakeLists.txt should looks like在这种情况下,您的 CMakeLists.txt 应该看起来像
cmake_minimum_required(VERSION 3.10)
project(projectName)
set(CMAKE_CXX_STANDARD 14)
find_package (Eigen3 3.3 REQUIRED NO_MODULE)
include_directories(${EIGEN3_INCLUDE_DIR})
add_executable(myTargetName
Example/MyTopTen/MyTopTen.cc
Example/MyTopTen/MyTopTen.h
Example/Example.cc
)
target_link_libraries (myTargetName Eigen3::Eigen)
After that Reload CMake project in CLion via Tools | CMake | Reset Cache and Reload Project
之后通过
Tools | CMake | Reset Cache and Reload Project
Tools | CMake | Reset Cache and Reload Project
Tools | CMake | Reset Cache and Reload Project
. Tools | CMake | Reset Cache and Reload Project
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.