Use Sublime text 3 to build a lightweight C + + edit/Compiler

Source: Internet
Author: User
Tags sublime text



0x01. Software Preparation:






Sublime Text 3



MinGW






0x02. Installation & configuration MinGW:




The path variable adds a C:\MinGW\bin



Note that this configuration requires a reboot to take effect, but there are ways to enforce it:

Verify that the variables are set successfully or not:

set path = C: / MinGW / bin;% PATH%;
Verify the success of variable setting:

mingw-get // If the MinGW interface appears, the setting is successful
Install g ++

mingw-get install gcc g ++
Verify the success of g ++ installation:

g ++ -v // Print out g ++ version information, indicating successful installation
 

0x03. Configure Sublime text 3

Open Tools-> Build System-> New Build System and type the following information:

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

    "variants":
    [
        {
            "name": "Run",
            "cmd": ["cmd", "/ c", "g ++", "$ {file}", "-o", "$ {file_path} / $ {file_base_name}", "&&", "cmd", "/ c", "$ {file_path} / $ {file_base_name}"]
        },
        {
            "name": "RunInCommand",
            "cmd": ["cmd", "/ c", "g ++", "$ {file}", "-o", "$ {file_path} / $ {file_base_name}", "&&", "start", "cmd", "/ c", "$ {file_path} / $ {file_base_name} & pause"]
        }
    ]
}
After Ctrl + S, it will prompt to save, please make sure the format of the file name is "XXX.sublime-build"
XXX means random, I changed to "c ++. Sublime-build"
After this step is completed, select the solution you just saved in the Build System, that is, c ++

Then, in Preferences-> Key Bindings-User, you can fill in the following scheme:

{"keys": ["ctrl + alt + B"], "command": "build", "args": {"variant": "RunInCommand"}}
Here you can freely modify the running shortcut keys.

0x04. Use Note
C / C ++ source files must be run in a directory in English!

 

0x05.END

 

Use sublime text 3 to build a lightweight C / C ++ editor / compiler

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.