用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