Configuring compile and run C + + programs in Sublime Text 3

Source: Internet
Author: User
Tags sublime text

Download extract MinGW to target directory, this installation of the decompression directory is C:\MinGW

Set environment variables. Right-click My Computer, Properties--advanced--environment variables.

Add C:\MinGW\bin in the System environment variable path (if there are other variables inside, remember to add the English semicolon;), click OK, OK, OK

Test that the MinGW is installed successfully. Win+r, run the cmd command line, execute g++-V in the cmd window, as shown below for success;

Click Preferences, then click Browse Package, new file C++.sublime-build file contents as follows:
{    "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"]        }    ]}
Write the test file Helloworld.cpp file contents as follows:
#include <iostream>using namespacestd;intMain () {intI;cout<<"input I:"<<endl;cin>>I;cout<<"i="<<i<<"HelloWorld"<<Endl;return 0;}
Press Ctrl+b to enter the value of the variable I, showing:

Congratulations, the configuration is successful!

Configuring compile and run C + + programs in Sublime Text 3

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.