C++ c++;错误:在';之前需要构造函数、析构函数或类型转换*';代币
查看了有关此编译器错误的所有类似问题。下面的最小化代码再现了错误,我看不出问题出在哪里。从这里开始阅读,怀疑是返回类型node*(作为一个结构)无效,但是还需要指定什么作为返回类型呢?多谢各位 头文件:C++ c++;错误:在';之前需要构造函数、析构函数或类型转换*';代币,c++,C++,查看了有关此编译器错误的所有类似问题。下面的最小化代码再现了错误,我看不出问题出在哪里。从这里开始阅读,怀疑是返回类型node*(作为一个结构)无效,但是还需要指定什么作为返回类型呢?多谢各位 头文件: #include<cstdio> #include<cstdlib> class double_clist { struct node { int info; struct node *next; struct node *prev;
#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;
}
};
#包括
#包括
类双_clist{
结构节点{
国际信息;
结构节点*下一步;
结构节点*prev;
};
节点*启动;
节点*最后;
整数计数器;
公众:
节点*创建_节点(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\u clist::create\u node(int值){//此行出错。
计数器++;
结构节点*temp;
temp=新建(结构节点);
温度->信息=值;
temp->next=NULL;
temp->prev=NULL;
返回温度;
}
当它到达这里的节点时,它还没有看到它在双客户端中。您还需要在前面加上double\u clist::
double_clist::node* double_clist::create_node(int value) {
当它到达这里的节点
时,它还没有看到它在double\u clist
中。您还需要在前面加上double\u clist::
double_clist::node* double_clist::create_node(int value) {
struct节点*temp代码>->节点*温度代码>,新建(结构节点)代码>->新建节点代码>结构节点*temp代码>->节点*温度代码>,新建(结构节点)代码>->新建节点代码>