Preprocessor #ifndef

后端 未结 3 1207
星月不相逢
星月不相逢 2021-01-17 02:54

Assume I have a.h which includes the following:




Assume I also have b.

3条回答
  •  不要未来只要你来
    2021-01-17 03:31

    It's normal that most header start with

    #ifndef _HEADERFILENAME_H_
    #define _HEADERFILENAME_H_
    

    and end with the following line:

    #endif
    

    If you include a header two times, the second time your programm won't include the full header again because of the #ifndef, #define and #endif

提交回复
热议问题