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.
Read More:
- C++ ERROR redefinition of ‘class ***’
- Error: redefinition of class XXX
- Error resolution: Error: redefinition of class xxx
- C++ Error: allocating an object of abstract class type
- Error c2371: ‘xxx’: redefinition; different basic types solutions
- C++:error C2228: left of ‘.str’ must have class/struct/union
- Error: requesting member ‘*’ of ‘*’, which is a non-class type ‘*’
- The shell runs the class file and imports the jar package that the class depends on
- Pit encountered by entity class data type BigDecimal
- C++ foundation — clear/erase/pop of string class_back
- Error c2259 cannot instance abstract class due to following members
- Problems encountered after Maven installation or upgrade: could not find or load main class org.codehaus.plexus .class…..
- C + + error prototype for… Does not match any in class
- Java gets the type t.class of generic t
- Unit Android converts c# class to JSON file and reports an error
- Error: expected class name before ‘{‘ token
- The differences between the equals method in the string class and the equals method in the object class
- Loading class `com.mysql.jdbc.Driver‘. This is deprecated. The new driver class is `com.mysql.cj.jdb
- Error c2951: template declaration can only be used at the global, namespace, or class scope. Error c2598: link specification must be at the global scope
- OpenGL class library and environment configuration under win10 and vs2015