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