Easy Compilation guards instead of #ifndef macros
![]()
Did you ever noticed the following lines in the your header file?
#ifndef _MYHEADER_H_ #define _MYHEADER_H_ ... #endif
They are protection macros to protect the header file from multiple compilation. Assume your header file is included many time in different CPP. if you are not using these protection macros, your header file will be included more than once and will give you a Multiple declaration error. To prevent that, these macros are being used. But there is a more simple method in VC++ compiler extension.
![]()
You can use #pragma once in your header file. E.g.
#pragma once ...
If you use #pragma once, then the header file will be included only once in your compilation.