vs调试Linux带界面程序,vs2017调试linux程序

本文介绍如何在Windows 10中启用开发者模式并安装Subsystem for Linux (WSL),随后通过更换软件源加速软件包管理,并详细说明了SSH服务配置过程,包括端口更改等关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.win10设置为开发人员模式,并安装subsystem for linux(命令行输入bash就可以安装)

2.登录并su到root,然后修改/etc/sudoers,在最后一行加(一定要在最后一行):

youname1     ALL=(ALL)  NOPASSWD:ALL

3.修改/etc/apt/sources.list,注释掉原来的源,添加:

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse

修改后apt-get update

4.安装相关开发软件

sudo apt install -y build-essential

sudo apt install -y gdbserver

sudo apt install -y openssh-server

修改/etc/ssh/sshd_config,把PasswordAuthentication改为yes

sudo ssh-keygen -A

sudo service ssh start          每次启动控制台都需要执行,因为控制台会关掉WSL的所有程序

5.修改ssh端口,默认的22被windows占用了

vi /etc/ssh/sshd_config

如果要使用vs2017调试linux程序,参考:

https://blogs.msdn.microsoft.com/vcblog/2017/02/08/targeting-windows-subsystem-for-linux-from-visual-studio/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值