Keith B. answered 08/22/19
Software Engineer and Math Geek
These are compiler directives, ie, instructions for the compiler. When your code is compiled or converted into machine code, the compiler makes several passes through the code. The first pass looks for these directives; for example #include instructs it to bring in the code in the given file.
The #define directive says to define this value as this. The #ifndef directive (which must be paired with a closing #endif) is used to test to see if a value has been defined (there is also a #ifdef). By testing to see if a value has not yet been defined -- then defining it -- it ensures that the code contained within the #ifndef/#endif block is only defined once, regardless of how many times the header file is included (Header files are often included by other header files, and if you try to declare something -- like a class -- more than once, the compiler will complain.
Newer compilers recognize a directive of #pragma once, directs a compiler to process a header file only once, regardless of how many times it sees a #include