Reputation: 3207
Suppose I have the following header file:
#ifndef TESTCLASS_H
#define TESTCLASS_H
#include <string>
class TestClass
{
public:
TestClass();
std::string test();
};
#endif // TESTCLASS_H
Do I have to put a guard around #include <string>
as well? If not, what if main.cpp also has #include <string>
?
Upvotes: 1
Views: 86
Reputation: 37950
No, because the string
header file has got its own include guards (as do the header files of all sensible libraries).
Upvotes: 6