Yes, if I understood you correctly, it does matter.
Here's a quick review on inclusion/header guards.
An inclusion/header guard (macro guard) is a construct that prevents problems that have to do with multiple inclusion of files. To be more specific, they prevent multiple definitions within the same translation unit.
Like I said, I'm not sure if I've understood you correctly, but I've tried to reconstruct the possible setup you may have, which is erroneous:
person.h
1 2 3 4 5 6 7 8 9 10
|
#ifndef _PERSON_H_
#define _PERSON_H_
class Person {
public :
Person() {}
int member = 0;
};
#endif
|
people.h
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#ifndef _PERSON_H_//wrong
#define _PERSON_H_//wrong
#include "person.h"
#include <vector>
class People {
public :
People() {}
std::vector<Person> peopleVec;
};
#endif
|
The code I posted is incorrect, because
people.h is using the same macro which
person.h is using to prevent multiple inclusions. Since
_PERSON_H_
will have been defined before
person.h gets included,
person.h will not get included, and the
Person
class doesn't exist in the eyes of the compiler.
Instead, give the
people.h header it's own macro:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
#ifndef _PEOPLE_H
#define _PEOPLE_H
#include "person.h"
#include <vector>
class People {
public :
People() {}
std::vector<Person> peopleVec;
};
#endif
|