简体   繁体   中英

Error while compiling C program in Sublime 2(Windows)

I am trying to run c programs in sublime 2, windows machine, I have installed mingw, updated the path variable, and copied the following code in the sublime new build system

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

}

Then i wrote a simple C program

#include<stdio.h>


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

}

On pressing CTRL+SHIFT+b and CTRL+b , i am getting the following error

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

The problem is most likely here:

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

The dot-slash is current-directory notation for *nix systems, but you're on a Windows system, so try changing that to

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

Likewise, you will want to change the forward-slashes / in your path to backslashes \\ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM