Principle
- 1. First you have to configure the C++/C environment to be able to compile
- 2. The environment variables of the execution environment are configured in window and can be used globally
- 3. Sublime text creates a new build mechanism. and set the global compilation environment with a change
Specific process
- The ability to compile C + + environments. We install MinGW to download Mingw-get-setup and install it on my network first. I was installed by default. The path after installation is C:\MinGW
- Set the path of the MinGW in the window environment variable, in detail to see a paste. Then check to see if you can use g++ in window. Beat the g++-v command in CMD. Assuming that g++ is not a system command, it proves that your g++ has not been installed successfully.
There are two reasons why this problem occurs:
1. Installation finished MinGW but you did not install g++ (may need to be checked during installation). We can use this command to install g++. At cmd knock Mingw-get install g++
2. The environment variable you set does not take effect. I had to restart the computer before it worked.
- On the sublime Text, new Build System. Details are tools| Build System|new Build System creates a c.sublime-build. How to configure it? Please see source code c.sublime-build (may need to FQ), can also download c.sublime-build on my network disk.
And put your c.sublime-build file in preferences|. Browse packages| In user
- Create a new C file and write a simple introductory C code
#include <stdio.h>int main (void) {printf ("Hello world\n"); return 0;}
After saving press the shortcut key CTRL + B is compiled, then CTRL + SHIFT + B. A console will appear
Acknowledgements Sublime Text 2 configuration compilation C language
Sublime Text 2 && MinGW g++ on Windows
Sublime text 2 in Windows Building C + + surrounding environment
Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.
Let your sublime text write C code (sublime text 2 configuration Build C development environment)