How do you configure MinGW with Sublime Text 3?

為{幸葍}努か 提交于 2019-12-23 17:13:09

问题


I recently installed MinGW and I've been trying to get it to work with Sublime Text 3 to get it to open cmd when when I compile the script, however nothing works.

When I go to Tools > Build System > New Build System and save this script, I keep on getting an error:

'"C:...." is not recognized as an internal or external command operable program or batch file.'

For some reason, the executable is never created. How do you get this to work? I have gcc in C:\MinGW\bin

{
"cmd": ["gcc", "${file}", "-o", "${file_base_name}.exe"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,

"variants":
[
    {
        "name": "Run",
        "cmd": ["start", "cmd", "/k", "${file_path}/${file_base_name}.exe"],
        "shell": true
    }
]
}

回答1:


This works as I had intended:

{
"cmd": ["gcc", "$file_name", "-o", "${file_base_name}.exe", "&&", "start", "cmd", "/k" , "$file_base_name"],
"selector": "source.c",
"working_dir": "${file_path}",
"shell": true
}


来源:https://stackoverflow.com/questions/34742296/how-do-you-configure-mingw-with-sublime-text-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!