Eclipse C :班级,名称空间,枚举找不到
Eclipse C++: class, namespace, enumeration not found
问候,预先感谢您!
我正在MacOS X 10.12工作;Eclipse Neon 4.6,使用MacOS X GCC编译。我收到以下错误:
../matrix.h:82:1: error: 'Matx' is not a class, namespace, or enumeration
`Matx::~matx(){`
`^`
`../matrix.h:27:7: note: 'Matx' declared here`
由于以下matrix.h
文件,错误令人困惑:
#ifndef MATRIX_H_
#define MATRIX_H_
#include <iostream>
template <class T>
class Matx {
int ROWS, COLS ;
int colix[COLS], rowix[ROWS] ;
T ** array ;
Matx(int, int) ;
~Matx() ;
void rowSwap() ;
void size( void ) ;
void swapRows(int i1, int i2) { std::swap(this->array[i1], this->array[i2]); }
void printMat( void ) ;
};// end class matrix
template <class T>
Matx::~Matx(){
delete this->array ;
}// end ~matx()
请注意,文件中还有更多功能,但是所有这些功能在所有功能中都是一致的。我尝试使用范围分辨率定义功能,没有Matx::~m
,但无济于事。任何帮助都非常感谢!
您应该像这样编写函数的定义:
template <class T>
Matx<T>::~Matx(){
delete this->array ;
}// end ~matx()
此部分是错误的。
int ROWS, COLS ;
int colix[COLS], rowix[ROWS] ;
您定义了大小col和行的阵列。但是这些是非CONST成员变量。您需要编译时间表达式。例如:
static constexpr int ROWS = 4;
static constexpr int COLS = 4;
相关文章:
- 是否有 Windows 用户空间函数来枚举连接的网络共享?
- 如何公开库的枚举,以便我的代码不必键入整个命名空间来使用该枚举?
- 如何理解c++中在命名空间内部定义的枚举类型enum
- C++-使用来自不同头文件、相同命名空间的枚举
- 访问向量字段的键 - 枚举类还是命名空间中的枚举?
- 枚举类不是类或命名空间
- 在命名空间中使用枚举
- 将C 枚举类成员拉入全局名称空间
- 枚举、类、命名空间和长名称
- 将C枚举导入C 名称空间
- C++11 枚举类命名空间块
- Eclipse C :班级,名称空间,枚举找不到
- 类名和枚举值之间的冲突:无需命名空间即可解析
- 命名空间中的doxygen枚举
- 在不膨胀命名空间的情况下在C++中声明枚举的好方法
- 将C++命名空间枚举包装到C接口
- 在类中映射命名空间枚举
- 不是创建模板类后的类、命名空间或枚举
- 不同文件中同一命名空间中的 2 个不同枚举中的相同标识符
- 或命名空间中的枚举