由於學習緣由我須要在mbp 遠程調整linux ,特地研究了下clion如何遠程linux 編譯linux
Linux 配置
爲了使用CLion 進行開發調試Linux相關的軟件版本推薦以下c++
Cmake 3.x 以上
gdb 7.8.x 以上
本次配置使用的Linux 版本爲Centos 7.4 mini學習
首先卸載預裝Cmake 2ui
yum remove cmake
首先安裝必要的環境3d
yum install -y gcc g++ gcc-c++ make automake texinfo wget
Cmake 安裝
下載Cmake 3.14, 你能夠在這裏找到你須要版本的Cmake下載,這裏採用了3.13.4的版本調試
wget https://cmake.org/files/v3.14/cmake-3.14.3.tar.gz tar -xf cmake-3.14.3.tar.gz cd cmake-3.14.3 ./configure make sudo make install
安裝好後的Cmake位於 /usr/local/share/cmake-3.13/,可執行程序位於/usr/local/bin/cmakecode
爲了讓CLion可以自動識別,構建軟鏈接。blog
ln -s /usr/local/bin/cmake /usr/bin/cmake
gdb
在安裝GDB 前請先安裝termcap庫,不然在安裝gdb時會報該庫找不到的錯誤。ip
termcap 安裝
下載termcap 1.3.1 , 你能夠在這裏找到你須要版本的termcap 下載,這裏採用了1.3.1的版本開發
wget https://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz tar -xf termcap-1.3.1.tar.gz cd termcap-1.3.1 ./configure sudo make install
gdb 安裝
卸載預裝的gdb
yum remove -y gdb
下載gdb 7.9 , 你能夠在這裏找到你須要版本的gdb 下載,這裏採用了7.9的版本
wget http://mirrors.ustc.edu.cn/gnu/gdb/gdb-7.9.tar.xz tar -xf gdb-7.9.tar.xz cd gdb-7.9 ./configure
make
若是在make 過程當中提示下面錯誤
configure: error: no termcap library found
請按照的 termcap 安裝
貌似遇到textinfo沒安裝的,能夠yum install texinfo
而後
sudo make install
gdb將被安裝到/usr/local/share/gdb目錄,可執行程序位於/usr/local/bin/gdb
爲了讓CLion可以自動識別,構建軟鏈接。
ln -s /usr/local/bin/gdb /usr/bin/gdb
CLion 配置
首先安裝CLion, CLion官方‘’
建議使用ToolBox安裝,比較省心。ToolBox官方
環境配置
安裝完成以後打開CLion,選擇 Configure -> Settings
展開 Build, Execution, Deployment -> Toolchains,而後點擊右側加號,增長編譯執行按鈕。
點擊 Environmen,在展開的菜單中選擇 Remote Host。