Tag Archives: Problem sets

Error c2011: “a certain class”: redefinition of “class” type

Reason: A class is defined multiple times, for example in the header file of class A #include “B.h”, and again in the CPP file of class A #include “B.h”
Solution: Add #pragma once to the header to prevent a header from being included multiple times and ensure that the header is compiled once. You can also use # IFNDEF, #define, #endif to prevent redefinition.