Programming: Using #ifndef #define and #endif in the Header File So the Code Only Compiles Once

A header file needs a mechanism to only allow the code to compile once, even if the header file is included in other files more than once. The #ifndef is used for this purpose.



Usage: #ifndef uniqueName #define uniqueName //Code to be compiled only once #endif
Back to blog

Leave a comment

Please note, comments need to be approved before they are published.