Sublimetext compiling C development environment Setting _c language

Source: Internet
Author: User

Working with tools
Sublime Text 2
MinGW

1. Configure Environment variables

After downloading and installing sublime Text 2 and MinGW, you need to add the path of the bin directory under the MinGW installation directory to the environment variable path. As shown in figure:

2. Invoke C compiler via sublime text

The configuration of the C + + compiler (by default g++ compilation) has been added by default in sublime text, and is invoked by typing ctrl+b. The results of the compilation are entered in the output bar of St, as shown in the figure:

3. Display the console output directly in sublime Text 2

If you do not want to compile the file every time, you need to switch the window to run the compiler generated EXE to see the results. can also be in a simple configuration, directly to the output of the console display in St, also do not need to switch windows, just to call Ctrl+b compiled and then type Ctrl+shift+b run. Modify the Packages\c++\c++.sublime-build file in the packages directory of sublime text to:

Copy Code code 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++",
"Encoding": "cp936",

"Variants":
[
{
"Name": "Run",
"cmd": ["${file_path}\\\\${file_base_name}.exe"]
}
]
}

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.