首先谈到这个问题,我看了几个问题,其中一半似乎不适用,另一半,坦率地说,我只是不理解。
这是我的问题的简单实现,
错误:未定义模板“QList”的隐式实例化
<VPNConnection>
'
具体而言
VPNList
结构中的对象
User_VPN_Info
值得注意的是,在一篇文章中提到要让你的“孩子”在父母之上,否则就要实现一种原型,因此
VPNConnection
属于
User_VPN_Info
.
基本解释:
结构
User_VPN_Info
应该实现结构
VPN连接
以QList的形式保存多个
VPN连接
裸代码:
struct VPNConnection{
QString ip,cipher,protocol;
int port;
bool lzo_compression;
VPNConnection(){}
VPNConnection(QString _ip, QString _cipher, QString _protocol, int _port, bool _comp){
ip = _ip;
cipher = _cipher;
protocol = _protocol;
port = _port;
lzo_compression = _comp;
}
};
struct User_VPN_Info{
QString vpn_name, vpn_expire;
int DaysLeft;
QList<VPNConnection> VPNList;
-------- <<< --- underlined with error
User_VPN_Info(){}
User_VPN_Info(QString _vpn_name, QString _vpn_expire, int _DaysLeft){
vpn_name = _vpn_name;
vpn_expire = _vpn_expire;
DaysLeft = _DaysLeft;
}
QString getString(){
return(vpn_name + " + " + vpn_expire + " + " + QString::number(DaysLeft) + " ; ");
}
};
我想了解是什么导致了这个错误,以及为什么会发生在这里?
错误:未定义模板“QList”的隐式实例化
<VPN连接>
'
更新
经过更多的研究,我发现
this
用户-dasblinkenlight
从而改变为:
QList<VPNConnection> *VPNList;
有人愿意解释一下吗?