Windows11通过wsl安装centos7,visual stdio连接centos7跨平台编译

目标:

windows上使用visual stdio编码(c++),然后跨平台在windows和linux上分别运行

需要安装的软件:

windows11: 安装wsl2,安装visual stdio2022(或者其他版本)

一,通过windows11安装wsl2

参考:旧版 WSL 的手动安装步骤 | Microsoft Learn  

提取关键步骤

1.启用适用于 Linux 的 Windows 子系统:打开powershell并输入,以管理员身份运行:

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

2.启用虚拟化:以管理员打开powershell输入下列命令

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

3.下载X64的WSL2 Linux内核升级包并安装
https://link.zhihu.com/?target=https%3A//wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

4.设置WSL默认版本

wsl --set-default-version 2

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值