有人能帮我在SublimeText 3中配置MinGW吗? (新手) [英] Could someone help me configure MinGW in SublimeText 3? (Newbie)

查看:134
本文介绍了有人能帮我在SublimeText 3中配置MinGW吗? (新手)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在此处下载了第一个链接后,下载了MinGW https://isocpp.org/get-started 和现在我需要在SubimeText 3中进行配置。我知道我应该去Tools> Build System> New Build System ...但是我应该在那里指定什么?

I downloaded MinGW following the first link here https://isocpp.org/get-started and now I need to configure it in SubimeText 3. I know I should go to Tools > Build System > New Build System... But what should I specify there?

我使用Win7x64。并且MinGW在C:\ MinGW中

I use Win7x64. And MinGW is in C:\MinGW

推荐答案

构建系统的完整参考是 here 。您需要做的第一件事是确保 C:\MinGW\bin 目录位于 PATH ,然后重新启动Sublime,这样就可以获得更改。

The complete reference for build systems is here. The first thing you need to do is make sure that the C:\MinGW\bin directory is in your PATH, then restart Sublime so the change gets picked up.

完成这些后,创建一个包含以下内容的新构建系统:

Once you've done that, create a new build system with the following contents:

{
    "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
        }
    ]
}

并保存为 Packages / User / C.sublime-build Packages 文件夹是通过选择 Prefe打开的文件夹rences - >浏览软件包...

and save it as Packages/User/C.sublime-build where the Packages folder is the one opened by selecting Preferences -> Browse Packages....

您现在可以通过选择 工具 - >构建系统 - > ç 即可。准备好编译后,保存源文件,然后按 Ctrl B 进行编译。要运行该程序,请打开 Ctrl Shift B 并打开 cmd 窗口运行生成的 .exe 文件,然后保持打开状态直到关闭它(这样您可以看到该程序生成的任何输出)。

You can now choose this build system by selecting Tools -> Build System -> C. Once you are ready to compile, save your source file, then hit CtrlB to build. To run the program, hit CtrlShiftB and a cmd window will open up to run the resulting .exe file, then stay open until you close it (so you can see any output produced by the program).

您可以尝试使用Sublime附带的 C ++ 构建系统,但过去有些用户遇到问题,特别是在Windows上,所以这个自定义的可能更适合你的需求。

You can try to use the C++ build system that comes with Sublime, but some users have run into issues with it in the past, especially on Windows, so this custom one may suit your needs better.

祝你好运!

这篇关于有人能帮我在SublimeText 3中配置MinGW吗? (新手)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆