这段代码出了什么问题!!!! 未定义引用`bool BioQt :: QSequenceValidator :: IsValidDNASequence(BioQt :: QSequence)'
class QSequenceValidator
{
public:
template<class SEQ>
static bool IsValidDNASequence(SEQ seq);
}
template<class SEQ>
bool IsValidDNASequence(SEQ seq)
{
foreach (QChar c ,seq)
{
if(!CompoundSet::DNACompoundSet().contains(c,Qt::CaseInsensitive))
return FALSE;
}
return TRUE;
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
qDebug()<<QSequenceValidator::IsValidDNASequence(pop);
return a.exec();
}
答案 0 :(得分:0)
在QSequenceValidator::
定义之前添加IsValidDNASequence
。目前您正在定义自由函数,而不是静态成员函数。即。
template<class SEQ>
bool QSequenceValidator::IsValidDNASequence(SEQ seq)
{
...
}