无法确定 IDE 在 C++ 中说出未声明标识符的原因
Trouble with identifying why the IDE is saying undeclared identifier in C++
我现在有一个带有这些代码行的类。我正在努力的是我的IDE说"使用root的未声明标识符"的功能写入
这是为什么呢?
template<typename T>
class X
{
public:
const void write(std::ostream & output);
private:
std::unique_ptr< TreeNode<Ty> > root;
};
const void write(std::ostream & output)
{
root->write(output);
}
编辑以显示模板代码的更完整范围。
尝试使用范围解析运算符告诉编译器您的write
函数属于class X
:
const void X::write(std::ostream & output)
{
root->write(output);
}
编辑 1:模板
使用模板,语法变为:
template<typename T>
const void
X<T>::write(std::ostream & output)
{
root->write(output);
}
相关文章:
- #ifdef和未声明的标识符
- 未声明的标识符编译暗黑破坏神 2 程序"muleview"
- 在顶点着色器中使用 OpenGl 的未声明标识符,我在顶点着色器中绘制三角形时遇到问题
- Google protobuf 时间戳未声明标识符,在 Windows 上具有C++
- 使用未声明的标识符"sqrt"?
- 对类 (C++) 中的私有变量使用未声明的标识符
- 我的代码中有错误,未声明的标识符
- 未定义的标识符/未声明
- 错误:在 C++ 'std'使用未声明的标识符
- 在编译器之前检测未声明的标识符
- 使用未声明的标识符'temp'
- 使用未声明的标识符"yylex"和"yyin"?
- 使用"class"关键字,后跟未声明的标识符
- 未声明的标识符错误,但变量定义正确 (?)
- C2065 'cout':未声明的标识符
- C++模板模板参数中未声明的标识符
- 错误:在 C++ 目标 c 混合'self'使用未声明的标识符
- C++循环依赖关系,未声明的标识符
- 我的函数调用 (C++) 中的未声明标识符
- 未找到标识符和未声明的标识符