The #ifndef in the header file, this is a very key thing. For example, you have two C files, and these two C files include the same header file. At compile time, these two C files are compiled into a running file together, so the problem comes with a lot of conflicting statements. or the contents of the head file in #ifndef and #endif. Regardless of whether your header file will be referenced by multiple files, you should add this. The general format is this:
1 #ifndef < identification >2#define < identity >3456 7#endif
< identity > can theoretically be freely named, but the "identity" of each header file should be unique. The naming convention for an identity is usually the header file name all uppercase, underlined, and the "." in the file name. Also becomes underlined, such as: stdio.h
1 #ifndef _stdio_h_ 2 #define _stdio_h_34 ... 5 6 #endif
The #ifndef of C tips