I have these files that were given to me to solve and I have some doubts about header guard.
In
testGuards.h
, there is a define like__HEADER_GUILD_SAFEBOX__
, but the#ifdef
asks if__GUILD_SAFEBOX__
is defined, so I don't know if this#ifdef
should ask about__HEADER_GUILD_SAFEBOX__
instead of__GUILD_SAFEBOX__
.In
testCpp.h
I ask if__GUILD_SAFEBOX__
is already defined, but, as far I know, it is already defined intestGuards.h
, but here (in cpp), we never enter into the#ifdef
, and I not know, how to know if is not defined, and if not defined, then define it.
I have 2 codes.
testGuards.h
#ifndef __HEADER_GUILD_SAFEBOX__
#define __HEADER_GUILD_SAFEBOX__
#include "stdafx.h"
#ifdef __GUILD_SAFEBOX__
[...]
#endif
testCpp.cpp
#include "stdafx.h"
#ifdef __GUILD_SAFEBOX__
#include "../common/tables.h"
[...]
#endif