The last time I learned how to successfully run the first C program under VC6.0, I felt excited. but with regard to compilation, links, and other steps, VC6.0 has helped me with it, and I feel it is really convenient, but this has brought me a problem, the steps are just reading books and learning about yourself. I have never practiced it, so I feel that I am not my own things. So I decided to write a program using notepad, but I had to compile the program and link it to VC.
First, I wrote the helloworld program in notepad.
#include<stdio.h>
int main(void)
{
printf("Hello,World!");
return (0);
}
Then, name the file suffix "hello. c" as the. c file.
Then in CMD, when CL hello. c is used, the CL compiler will generate two files. 1 is the hello.exe file, and 1 is the hello. obj file .. I know that the exe file is an executable file on the WINDOWS platform, but what is this. obj file? I don't understand it. I checked the information. Originally, the. obj file is in the common COFF format and is a target file. It can interact with other platforms. But how can I suddenly see two files! Originally, the CL command was used directly, and the compiler gave the automatic link. Here we need to add 1 parameter/c. In this way, the compiler will not automatically link. Well! After the parameter/c is added, only one. obj file exists !!! Now there is no. execommand to generate the. exe file. Another command tool is used here. link. This tool is the linker! Then I will do this: link hello. obj. The link is used to create a petabyte-style hello.exe for the winplatform. Hey hey! Now you can run the hello program on the WIN platform !!!
In the previous section, a user reminded me that # include <stdio. h> is to expand the stdio. h file as is here. So I thoroughly studied and proved his statement. Yes, thank you very much! But how can we see this process on our own. Add two parameters/c and/p after the cl command. I will try it! In this case, one. I file is added. Then I opened it, and there were more than 400 lines. I checked the stdio carefully. the content in h is the same, but one of the details is stdio. other files are included in the H file, so more than 400 lines are displayed after all the files are expanded!
Well! Now I almost understood how the first program was done!