52>>extern

Source: Internet
Author: User

The GCC compiler compiler has four stages, preprocessing, compiling, compiling, linking. The preprocessing phase compiles the included header files in the source code, such as Stdio.h, in the compilation phase, when GCC first checks the code for normalization, syntax errors, etc. to determine the actual work to be done by the code, and when the check is correct, GCC translates the code into assembly language, and the assembly phase is generated during the compile phase. S "file into binary target code; The link stage is to link the target file to an executable file.

The function of extern is to tell the compiler to let the variables of the extern declaration pass in the assembly phase (the compiler will give an error to the undefined variable), the variable is defined in another file, and then the variable in the other referenced file is found at the link. This variable must be a global variable in other files. If this variable is defined more than once, an error will occur. And this variable is best not defined in the header file.

52>>extern

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.