- WSL2环境准备,参考:https://zhuanlan.zhihu.com/p/166196630
- 开发wsl2下的程序,有两种方式:一种是cmake方式,可以直接选择"wsl gcc";一种是remote linux方式;
- cmake方式 参考:https://devblogs.microsoft.com/cppblog/c-with-visual-studio-2019-and-windows-subsystem-for-linux-wsl/ “C++ with Visual Studio 2019 and Windows Subsystem for Linux (WSL)” 中间需注意 "CMake可执行文件",要写成/usr/bin/cmake,而不是cmake:
- remote linux方式可以参考 https://docs.microsoft.com/zh-cn/cpp/linux/connect-to-your-remote-linux-computer?view=msvc-160 "在 Visual Studio 中连接到你的目标 Linux 系统", 以及 https://blog.csdn.net/The_Time_Runner/article/details/106038242 "WSL常见用法:启动ssh、修改用户名密码"; 主要是因为默认情况下启动SSH,会提示没有host key,需要通过ssh-keygen执行一次;此后在studio2019 选项-跨平台-连接管理器 中增加一个到localhost:22的连接即可。