Sublime C + + Build system configuration Experience

Source: Internet
Author: User

Recently ready to practice, so finally into the sublime camp, sublime really sexy.

In the configuration win7 C + + compilation run the integration environment when the problem encountered, so touch the JSON format, finally finally done their own.

Reference Document: Http://sublime-text.readthedocs.org/en/latest/reference/build_systems.html

In fact, in the end it is c++.sublime-build to write the following things (Tools->build system->new build system)

{    "Path":"D:\\codeblocks\\mingw\\bin",    "cmd":"g++ $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":"g++ $file-o $file _base_name.exe && start $file _base_name.exe"        }    ]}

Explain:

File name: Cpp.sublime-build means that the name of the compilation option that is sublime in the ctrl+shift+b when pressed is CPP, which can theoretically be changed freely.

Path: Because the cmd execution program (such as g++) when the default will go to the environment variable to find, this property is directly to the back of the path to find, so directly into the G++.exe directory is good

CMD: the command executed after the CPP is selected (performed by the system, which can be viewed as an effect performed in CMD), where $ is later parsed as a variable name

File_regex: Debug message echo of regular filter cmd

Working_dir: This is very comfortable, working path, if filled with F:\test is equivalent to the CD F:\test this meaning, so we have a relative path behind the file name is good

Selector: Mainly look at the suffix name, the file that matches these suffix will activate this compiling document, here to throw the. C. CPP piece to g++ just fine

Shell: Whether to eject the cmd window to run the program, the advantage of true is that you can enter parameters

Variants: This is a copy of the CPP compiled document, which is equivalent to alternate compilation options, which can be made up of multiple alternatives, each with {}

Name: Compilation option nickname, if you write run, press ctrl+shift+b will be more than a cpp:run such a compile option; name can only be written in variants

CMD: Here the cmd can overwrite the outside of the CMD, here in order to facilitate me to compile and run in the same sentence, so click on and Codeblocks F5 (F9?) Same as cool, middle with && connection

Other than that:

About the suspension of the program, did not find a good way to stop like Codeblocks, temporarily only system ("pause") or getchar the like, (small program, do not care about the system ("pause") how much resources this matter)

After this, go back to any. cpp file Press Ctrl+b, choose Run to compile + run, if the wrong command Palette (the same thing in the console below sublime) will show a bunch of things, press F4 and SHIFT+F4 can see the error, Amazing discovery can jump straight to the wrong line, 666

The two days of learning PYTHON,PHP,XSS also a small number of small problems, but the time is pressing. (then you also brush the play game!) Not recorded ~ And so grow up again

Goodbye

Sublime C + + Build system configuration Experience

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.