用vscode写c/c++


用vscode写c/c++

1. 安装wsl

windows下安装linux(ubuntu)

2. 打开设置

3. 输入run code

随便找一个地方粘贴,会出现一大段代码

4. 把c对应的代码修改

"c": "wsl eval '''a=$dir"; a=${a//😕}; a=${a%?}; a=${a//\\//}; cd /mnt/$a; gcc $fileName -o $fileNameWithoutExt; ./$fileNameWithoutExt; rm -rf $fileNameWithoutExt'''",

5. 新建Hello.c文件,输入以下代码

#include<stdio.h>

int main(int argc, char const *argv[])
{
    printf("hello world\n");
    int i;
    scanf("%d", &i);
    printf("%d", i);
    return 0;
}

6. 鼠标右击,run code

7. 测试

成功!


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM