FMUSER Wirless Transmit Video And Audio More Easier !

[email protected] WhatsApp +8618078869184
Language

    Several methods and points of reference to header files

     

    Good programming habits will directly affect the quality of the code, in embedded C ++ / C ++, there are many reference methods and methods of the header file, and some details will also affect your code quality and compilation efficiency. Let's talk about the knowledge related to the header file; 1 Quotation marks "" and angle brackets "" #include uses quotation marks "" or sharp brackets "" this is specified. Generally speaking: The header files comes with the header files enclosed, so that the compiler looks up in the system file directory. #include "xxx.h" User-defined files are enclosed in dual quotes, and the compiler will first look for in the user directory. #include "xxx.h" Here you can see an article I shared by: #include Use quotation marks "and angle" "difference? 2 Reference header file path problem A project usually has multiple source files, you want to find these source files stored in different paths, you must let the compiler know the source code (path) position. There are a variety of ways to reference header files, add paths in your code, add paths in the IDE tool, and separate the absolute path and relative path. Let's take a brief talk about: 1. Reference header file in the source code Do not use the integrated development environment (IDE), usually add path information in the source code, such as reference header files in the source code: #include "/strongerhuang/robot/project/bsp/Bsp_uart.h"#include" ../bsp/bsp_uart.h "But will you find what is the difference between the above reference? One is an absolute path: #include "/strongerhuang/robot/project/bsp/BSP_UART.H" One is a relative path: #include "../Bsp/BSP_UART.H" 2. Reference header file in Ide tool We use the Keil, IAR this tool, which can add a path header file in the source code as above, and only need to configure the compilation path in the project. For example, Keil MDK: By menu Project - "Options for Taget -" C / C ++: Keil MDK default is a relative (project file) path. Here is recommended to read (project option configuration) related articles: Keil Series Tutorial 05_Engineering Target Options Configuration (1) Keil Series Tutorial 06_Engineering Target Option Configuration (2) IAR EWARM Similar: By menu Project - "Options -" C / C ++ Compiler: IAR is default an absolute path, usually we need to modify the relative path. Here is recommended to read (project option configuration) related articles: IAR series tutorial 06_Ergent node option configuration (1) IAR series tutorial 07_Engineering Node Option Configuration (2) 3 Head file related content By the way, several important contents about the header files are hereby. 1. Prevent head files from being repeatedly referenced This problem is not a problem for the old driver, but many newers have not understood what it means. Typically, in a xxx.h header file, there will be some of the following code: #ifndef _xxx_h # define _xxx_h #ENDIF "#" This is a pre-processing instruction, what does it mean? Simply, if there is no XXX.h header file, it will be included; otherwise it is not included (ie no reply). 2. Global (all) header files Some engineers like to put all the .h headers in an engineering in a global header file (such as global.h), then each .c source file to reference this (Global. h) header file. This is advantageous: profit: simple and convenient, don't worry because of missing a .h file, causing a mistake, warning; disadvantage: As long as one is revised. H, the project requires global compilation, waste a lot of time; so I personally recommend not use This global header file (global.h) manages the header file. This approach is only convenient for a while, which is not conducive to management, may not feel in this small project in several source files. However, if the project is getting bigger, special dozens of hundred source code, each source file code is relatively large, you modify one .h file, you can only wait for compilation. This approach may make your mindset when the project is more dare. Original title: Several methods and key points of reference header files in software projects Article Source: [WeChat public number: strongerhuang] Welcome to add attention! Please indicate the source of the article. Editor in charge: Haq, Read the full article, original title: Several methods and points of reference header files in software projects Article Source: [Micro Signal: Strongerhuang, WeChat public number: embedded program] 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