Tools used
- Sublime Text 2 ()
- MinGW ()
1. Configure Environment Variables
After downloading and installing Sublime Text 2 and MinGW, you must add the Path of the Bin directory under the MinGW installation directory to the environment variable Path.
2. Call the C compiler through Sublime Text
In Sublime Text, the C/C ++ compiler configuration is added by default (g ++ is used by default ).Ctrl+B
. The compilation result will be input to the output column of ST,
3. directly display the console output results in Sublime Text 2
After compilation, TypeRun. Convert the Sublime TextDirectoryFile:
}
If you need to use another compiler to compile a C program (such as VC), or you want to compile and run it directly, you can configure it on your own. For details, refer to my previous article: configure Sublime Text 2 as a C # code editor. The basic principles are the same: