WSL(Ubuntu terminal environment with Windows Subsystem for Linux)实用指令

WSL挺好用的,不用再安装VMWare了。具体的安装教程:
https://ubuntu.com/wsl
基础Linux指令:
https://ubuntu.com/tutorials/command-line-for-beginners#1-overview

一、将Windows中的文件复制到Linux中

cp /mnt/c/Users/Administrator/Desktop/FileName /home/Username

将windows系统中/mnt/c/Users/Administrator/Desktop目录下的FileName文件,复制到Liunx系统下的/home/Username目录下。其中,FileName是你要复制的文件名字,Username是Linux系统中的用户名。

二、安装g++

sudo apt-get update && sudo apt-get install g++

需要获取root权限,开始没加sudo,报错:Permission denied, are you root?

三、执行C/C++代码

如果代码在桌面上,直接把路径切换到Desktop目录下(切记:磁盘c字母为小写):

cd /mnt/c/Users/Administrator/Desktop

编译:

g++ CFile.cpp -o CFile

执行:

./CFile

其中,CFile.cpp中的代码:

#include "iostream"
using namespace std;

int main(void) {
	cout << "Hello World!!!" << endl;
	return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值