C++ ERROR redefinition of ‘class ***’

简介:

报错如下:

BaseSmoothingAlgorithm.h:4:7: error: redefinition of ‘class BaseSmoothingAlgorithm’

BaseSmoothingAlgorithm.h:4:7: error: previous definition of ‘class BaseSmoothingAlgorithm’

排错步骤:

1.查找类的定义后面是否少类“;”;一一查找后发现有,不是该类型的错误

2.少了防止被多次包含的宏,果真如此,修改如下

#ifndef _BASESMOOTHINGALGORITHM_H_
#define _BASESMOOTHINGALGORITHM_H_
#include "BaseSmoothingAlgorithm.h"
#endif

解决

相关文章
C4.
|
1月前
|
C++
C++class的构造与析构
C++class的构造与析构
C4.
50 0
|
7月前
|
存储 Cloud Native 编译器
C++ class良好的编程习惯
C++ class良好的编程习惯
|
11月前
|
C++
C++ --- error C2664: “LoadLibraryW”: 不能将参数 1 从“const char *”转换为“LPCWSTR”
C++ --- error C2664: “LoadLibraryW”: 不能将参数 1 从“const char *”转换为“LPCWSTR”
217 0
|
3天前
|
Linux C++
经验分享:C++ error:‘syscall’ was not declared in this scope
经验分享:C++ error:‘syscall’ was not declared in this scope
8 3
|
1月前
|
C++
【C++基础】类class
【C++基础】类class
18 1
|
1月前
|
程序员 C++
为什么c++要引入class关键字
总之,C++引入 `class`关键字是为了支持面向对象编程,通过封装、继承、多态和抽象等特性,提供了更强大、灵活和可维护的编程工具,使得程序开发更加高效和可扩展。这使C++成为一种强大的编程语言,广泛用于各种应用领域。
36 1
|
1月前
|
C++
【c++】日期类的实现-Class Date
【c++】日期类的实现-Class Date
【c++】日期类的实现-Class Date
|
1月前
|
编译器 C语言 C++
【C++专栏】C++入门 | 类和对象 | 类的引入、struct&class的区别、类的定义
【C++专栏】C++入门 | 类和对象 | 类的引入、struct&class的区别、类的定义
17 0
|
1月前
|
编译器 测试技术 调度
C++ 中 template<class T>和template<typename T>的区别
C++ 中 template<class T>和template<typename T>的区别
20 0
C4.
|
1月前
|
C++ 开发者
C++ struct与class
C++ struct与class
C4.
26 0