I. Environment Configuration1. Download and install MinGW
Address http://sourceforge.net/projects/mingw/2. Set the environment variable in the path variable, add the path to the path mingw, such as C: \ Program Files \ MinGW \ bin
Ii. Edit source codeAfter using the GNU Compiler in the Windows command line, you can use the command line window in Windows to simulate a Linux terminal. 1. Create the main. c file and run the edit main. c command to create and edit the main. c file. 2. edit the code (ps: Do you remember this simple interface ?) 3. Save and exit. Use the ALT key to call up the menu. Save the file and exit.
Iii. compilation process
The compilation process consists of four steps: preprocessing, compilation, assembly, and connection. preprocessing preprocessing mainly processes the preprocessing of commands such as "# include" and "# define" in the source file (refer to "Programmer self-cultivation"): (1) delete # define and expand the macro (2) processing condition compilation command. The Preprocessing Program first judges the condition, then modifies the source code based on the condition (3) deletes the comment (4) adds the row number and the file name identifier. Facilitate debugging (5) Delete "# include" and insert the corresponding header file using gcc-E main. c-o main. I command to obtain the main. I file 2. compile and generate the assembly code. Use the gcc-S main. I-o main. s command to compile the main. s file. 3. Compile the assembly code into machine commands. Run the gcc-c main. c-o main. o command to obtain the target file main. o 4. Connect to the database file and convert the target file into an executable file. Using the command gcc-ld, we can directly use gcc main. c-o main to generate executable programs. Of course, when gcc is used in Windows, the generated executable file is no longer main. out, but the main.exe File