C++ 错误:令牌之前的预期构造函数、析构函数或类型转换'*'
c++ error: expected constructor, destructor, or type conversion before '*' token
查看了有关此编译器错误的所有类似问题。 以下最小化的代码重现了错误,我看不出问题是什么。 从这里读到SO,怀疑它是返回类型节点*(作为结构)无效,但是还有什么可以指定为返回类型?谢谢。
头文件:
#include<cstdio>
#include<cstdlib>
class double_clist {
struct node {
int info;
struct node *next;
struct node *prev;
};
node *start;
node *last;
int counter;
public:
node *create_node(int);
double_clist() {
start = NULL;
last = NULL;
}
};
实施文件:
#include<cstdio>
#include<cstdlib>
node* double_clist::create_node(int value) { // Error on this line.
counter++;
struct node *temp;
temp = new(struct node);
temp->info = value;
temp->next = NULL;
temp->prev = NULL;
return temp;
}
当它到达这里node
时,它还没有看到它在double_clist
里面。您还需要以 double_clist::
开头。
double_clist::node* double_clist::create_node(int value) {
相关文章:
- LINUX 操作系统上的错误:令牌之前预期的构造函数、析构函数或类型转换'('?
- 错误 c++ 在令牌之前'('预期的构造函数、析构函数或类型转换
- 错误:在“(”标记之前进行预期的构造函数、析构函数或类型转换.即使我有一个构造函数
- 获取错误:在“(”标记之前进行预期的构造函数、析构函数或类型转换
- 如何销毁通过"放置新"构造的无析构函数类型
- 错误:令牌之前的预期构造函数、析构函数或类型转换'*'
- 不同的析构函数类型
- 字符串常量之前的预期构造函数、析构函数或类型转换
- 需要构造函数/析构函数/类型转换错误
- C++模板错误:'<'令牌之前的预期构造函数、析构函数或类型转换
- 错误:在非常简单的示例中,预期的构造函数、析构函数或类型转换
- 错误:'<'令牌之前的预期构造函数、析构函数、类型转换
- 令牌之前的预期构造函数、析构函数或类型转换'*'
- 错误:标记之前的预期构造函数、析构函数或类型转换?
- 错误:在“(”标记之前进行预期的构造函数、析构函数或类型转换
- C++ 错误:令牌之前的预期构造函数、析构函数或类型转换'*'
- C++ 错误:在“(”标记之前进行预期的构造函数、析构函数或类型转换
- 预期的构造函数、析构函数或类型转换
- 不稳定的声明行为:Rational.h:25:错误:在"&"标记之前预期的构造函数、析构函数或类型转换
- 编译时错误:期望的构造函数、析构函数或转换