Qt报错:call to constructor of '_ConfigDaoImpl' is ambiguous
原因
configform.cpp:4:13: error: call to constructor of '_ConfigDaoImpl' is ambiguous
configdaoimpl.h:16:5: note: candidate constructor
configdaoimpl.h:17:5: note: candidate constructor
解决
发现在ConfigDaoImpl.h中定义的类ConfigDaoImpl
可以生成两个无参构造函数,去掉一个就好。
class ConfigDaoImpl : public Dao
{
public:
ConfigDaoImpl()=default;//去掉
ConfigDaoImpl(QObject *parent = nullptr);
ConfigDaoImpl(const QString& tabName,QObject *parent = nullptr);
QVector<Config> findAll();
Config findByID(int m_id);
int deleteByID(int m_id);
int insert(Config& cfg);
};
还有一种原因是因为自己的类名和QT框架的某个类相同导致重名。
- ConfigDaoImpl constructor ambiguous call 39configdaoimpl constructor ambiguous call 39 builderexception collection ambiguous 进程 个子constructor calling configdaoimpl ambiguous ambiguity ambiguousmatchexception reflection ambiguous overloaded ambiguous mathfunc double ambiguity eliminate whether willing ambiguous restful handler methods