Loger's blog site

Loger's blog site,分享编程知识,顺便发发牢骚

0%

[重学C/C++]WSL+Clion打造C++开发环境

源码方式安装cmake

  • 下载cmake源码
1
wget https://github.com/Kitware/CMake/releases/download/v3.18.0-rc2/cmake-3.18.0-rc2.tar.gz
  • 安装
1
2
3
4
5
6
# 解压
tar -zxvf cmake-3.18.0-rc2.tar.gz
cd cmake-3.18.0-rc2.tar.gz
./configure
make
make install

报错:

1
2
Could not find OpenSSL.  Install an OpenSSL development package or
configure CMake with -DCMAKE_USE_OPENSSL=OFF to build without OpenSSL.

解决:

1
apt-get install libssl-dev

重新从 ./configure 开始

测试cmake

输入cmake –version

1
2
3
4
root@DESKTOP-2EQEO8O:~/cmake-3.18.0-rc2# cmake --version
cmake version 3.18.0-rc2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

正常输出版本号则表示安装成功!

OpenSSH

WSL默认应该是没有安装ssh服务端或者没有开启ssh服务。不管它有没有,干脆直接删除重装一遍:

1
2
apt-get remove openssh-server
apt-get install openssh-server

编辑sshd_config

1
2
3
vim /etc/ssh/sshd_config

PermitRootLogin 改为yes

重启ssh

1
service ssh restart

Clion

安装好clion之后,打开会提示配置运行环境。如果没有则通过File-Settingios-Build,Execution,Deployment-Toolchains进行配置。

提示Cmake找不到,默认安装好的cmake在/usr/local/bin/cmake

这时可以通过clion新建一个项目来测试了: