我正在尝试创建自定义类对象的QList,但是我收到了错误:
错误:C2923:'QList':'Read'不是参数'T'的有效模板类型参数
我的代码(用户标题):
...\user.h(13) : error C2065: 'Read' : undeclared identifier
...\user.h(13) : error C2923: 'QList' : 'Read' is not a valid template type argument for parameter 'T'
...\user.h(18) : error C2065: 'Read' : undeclared identifier
...\user.h(18) : error C2923: 'QList' : 'Read' is not a valid template type argument for parameter 'T'
...\user.h(27) : error C2065: 'Read' : undeclared identifier
...\user.h(27) : error C2923: 'QList' : 'Read' is not a valid template type argument for parameter 'T'
...\user.h(28) : error C2065: 'Read' : undeclared identifier
...\user.h(28) : error C2923: 'QList' : 'Read' is not a valid template type argument for parameter 'T'
和Qt给我错误列表:
#ifndef READ_H
#define READ_H
#include <QDataStream>
#include "book.h"
#include "date.h"
class Read
{
protected:
//Book book;
Date addDate;
Date readDate;
bool stillReading;
public:
Read();
~Read();
//Read(Book book, Date addDate, Date readDate, bool stillReading);
//Book getBook();
//void setBook(Book book);
Date getAddDate();
void setAddDate(Date addDate);
Date getReadDate();
void setReadDate(Date readDate);
bool isStillReading();
void setStillReading(bool stillReading);
};
QDataStream &operator<<(QDataStream &out, const Read &read);
QDataStream &operator>>(QDataStream &in, Read &read);
#endif // READ_H
阅读标题:
var _outerBlock = $("<outerBlock>");
for (var i = 0; i < 10; i++) {
var _innerBlock = $("<innerBlock>Serial " + i + "</innerBlock>")
_outerBlock.append(_innerBlock)
}
var _tmp = $("<div>");
var $output = _tmp.html();
Book被评论,因为它也会出错...
答案 0 :(得分:0)
答案 1 :(得分:0)
... \ user.h(13):错误C2065:'读':未声明的标识符
看起来在user.h中不知道Read。 也许date.h或book.h也包括user.h? (循环引用)
使用prototype classes有助于防止这种情况发生。