FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    C language programmer written header file and compiler

     

    The header file is a file that extension .h, contains a C function declaration and macro definition, and is cited by multiple source files. There are two types of header files: the header files written by the programmer and the header files comes with the compiler. To use the header file in the program, you need to use C pre-processing instructions #include to reference it. We have seen stdio.h header files in front, it is the header file with the compiler. The reference header file is equivalent to the contents of the copy header, but we will not copy the contents of the header file directly in the source file, because it is easy to make mistakes, especially in the program is composed of multiple source files. A Simple Practice IN C ++ or C ++ program, it is recommended to write all constants, macros, system global variables, and function prototypes in the header file, and reference these header files at any time when needed. Quote the grammar of the header file Use the pre-processing instructions #include to reference the user and system header file. Its form has two types: #include This form is used to reference the system header file. It searches for files named File in the standard list of system catalogs. When compiling the source code, you can put the directory in front of the list through the -i option. #include "file" This form is used to reference the user header file. It searches for files named file in a directory containing the current file. When compiling the source code, you can put the directory in front of the list through the -i option. Citing the operation of the header file #include instructions indicate that the C pre-regulator browsing the specified file as an input. The output of the preprocessor contains the output that has been generated, the output generated by the reference file, and the text output after the #include instruction. For example, if you have a header file header.h, as follows: Char * test (void); And an main program of using the header file, as follows: INT X; #include "Header.h" int main (void) {PUTS (TEST ());} The compiler will see the following code information: INT X; Char * Test (void); int main (void) {puts (test ());} Only quote one header file If a header file is referenced twice, the compiler handles the content of the two header files, which will generate an error. In order to prevent this, the standard practice is to put the entire content of the file in the conditional compile statement, as follows: #ifndef header_file # define header_file the entire header file # Endif This structure is usually the wrapper #ifndef. When the header file is retrieved again, the condition is false because header_file is defined. At this point, the preprocessor will skip the entire content of the file, and the compiler ignores it. Conditional reference Sometimes you need to select a reference to a program from multiple different header files. For example, you need to specify configuration parameters used on different operating systems. You can achieve this through a range of conditions, as follows: #if system_1 # include "system_1.h" #elif system_2 # include "system_2.h" #elif system_3 ... # ENDIF However, if the header file is more, it is very unmerder, the preprocessor uses the macro to define the name of the header file. This is the so-called conditional reference. It is not the direct parameter of the name of the header file, you only need to use the macro name instead: #define system_h "system_1.h" ... # include system_h System_H will extends, and the preprocessor will look for SYSTEM_1.H, just like #include initially prepared. System_h can be defined by your Makefile through the -d option. , Read full text, original title: head file in C language Article Source: [Micro Signal: C-STM32, WeChat public number: STM32 embedded development] Welcome to add attention! Please indicate the source of the article.

     

     

     

     

    List all Question

    Nickname

    Email

    Questions

    Our other product:

    Professional FM Radio Station Equipment Package

     



     

    Hotel IPTV Solution

     


      Enter email  to get a surprise

      fmuser.org

      es.fmuser.org
      it.fmuser.org
      fr.fmuser.org
      de.fmuser.org
      af.fmuser.org ->Afrikaans
      sq.fmuser.org ->Albanian
      ar.fmuser.org ->Arabic
      hy.fmuser.org ->Armenian
      az.fmuser.org ->Azerbaijani
      eu.fmuser.org ->Basque
      be.fmuser.org ->Belarusian
      bg.fmuser.org ->Bulgarian
      ca.fmuser.org ->Catalan
      zh-CN.fmuser.org ->Chinese (Simplified)
      zh-TW.fmuser.org ->Chinese (Traditional)
      hr.fmuser.org ->Croatian
      cs.fmuser.org ->Czech
      da.fmuser.org ->Danish
      nl.fmuser.org ->Dutch
      et.fmuser.org ->Estonian
      tl.fmuser.org ->Filipino
      fi.fmuser.org ->Finnish
      fr.fmuser.org ->French
      gl.fmuser.org ->Galician
      ka.fmuser.org ->Georgian
      de.fmuser.org ->German
      el.fmuser.org ->Greek
      ht.fmuser.org ->Haitian Creole
      iw.fmuser.org ->Hebrew
      hi.fmuser.org ->Hindi
      hu.fmuser.org ->Hungarian
      is.fmuser.org ->Icelandic
      id.fmuser.org ->Indonesian
      ga.fmuser.org ->Irish
      it.fmuser.org ->Italian
      ja.fmuser.org ->Japanese
      ko.fmuser.org ->Korean
      lv.fmuser.org ->Latvian
      lt.fmuser.org ->Lithuanian
      mk.fmuser.org ->Macedonian
      ms.fmuser.org ->Malay
      mt.fmuser.org ->Maltese
      no.fmuser.org ->Norwegian
      fa.fmuser.org ->Persian
      pl.fmuser.org ->Polish
      pt.fmuser.org ->Portuguese
      ro.fmuser.org ->Romanian
      ru.fmuser.org ->Russian
      sr.fmuser.org ->Serbian
      sk.fmuser.org ->Slovak
      sl.fmuser.org ->Slovenian
      es.fmuser.org ->Spanish
      sw.fmuser.org ->Swahili
      sv.fmuser.org ->Swedish
      th.fmuser.org ->Thai
      tr.fmuser.org ->Turkish
      uk.fmuser.org ->Ukrainian
      ur.fmuser.org ->Urdu
      vi.fmuser.org ->Vietnamese
      cy.fmuser.org ->Welsh
      yi.fmuser.org ->Yiddish

       
  •  

    FMUSER Wirless Transmit Video And Audio More Easier !

  • Contact

    Address:
    No.305 Room HuiLan Building No.273 Huanpu Road Guangzhou China 510620

    E-mail:
    [email protected]

    Tel / WhatApps:
    +8618078869184

  • Categories

  • Newsletter

    FIRST OR FULL NAME

    E-mail

  • paypal solution  Western UnionBank OF China
    E-mail:[email protected]   WhatsApp:+8618078869184   Skype:sky198710021 Chat with me
    Copyright 2006-2020 Powered By www.fmuser.org

    Contact Us