簡體   English   中英

在Sublime 2(Windows)中編譯C程序時出錯

[英]Error while compiling C program in Sublime 2(Windows)

我正在嘗試在sublime 2,Windows機器中運行c程序,我已經安裝了mingw,更新了path變量,並在sublime新構建系統中復制了以下代碼

{
"cmd": ["gcc -o $file_base_name $file && ./$file_base_name"],
"path": "C:/Program Files (x86)/CodeBlocks/MinGW/bin",
"shell": true

}

然后我寫了一個簡單的C程序

#include<stdio.h>


int main()
{
    printf("ihdfoihsdifhoisdhf");
    return 0;

}

在按CTRL + SHIFT + b和CTRL + b時,出現以下錯誤

    '.' is not recognized as an internal or external command,
operable program or batch file.
[Finished in 0.4s with exit code 1]

問題很可能在這里:

"cmd": ["gcc -o $file_base_name $file && ./$file_base_name"],

點斜杠是* nix系統的當前目錄符號,但是您使用的是Windows系統,因此請嘗試將其更改為

"cmd": ["gcc -o $file_base_name $file && $file_base_name"],

同樣,您將需要將path的正斜杠/更改為反斜杠\\

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM