This question already has an answer here:
- Include a .pro file in Qt? 1 answer
I just don't understand what is the overall layout of a Qt project with a program and a test...
The project of QTest tutorial only have the test program, but my project already have another program. If I add the test case, it claims "multiple definition of main()", as QTEST_MAIN is actually another main().
In addition, I got "undefined reference to vtable" on my test class, and don't know why..
I'm using Qt 5.2.1
This is my project file:
#-------------------------------------------------
#
# Project created by QtCreator 2014-06-06T13:42:19
#
#-------------------------------------------------
QT += core gui testlib
CONFIG += testcase
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = GutMiner
TEMPLATE = app
LIBS += -lquazip
SOURCES += main.cpp\
mainwindow.cpp \
dataform.cpp \
datavec.cpp \
distance.cpp \
linereader.cpp \
diseasepackage.cpp \
error.cpp \
newpagedialog.cpp \
resultpage.cpp \
test.cpp
HEADERS += mainwindow.h \
dataform.h \
distance.h \
datavec.h \
linereader.h \
diseasepackage.h \
error.h \
newpagedialog.h \
resultpage.h
FORMS += mainwindow.ui \
dataform.ui \
newpagedialog.ui
and this is my test source file:
#include <QObject>
#include <QTest>
#include "distance.h"
#include "diseasepackage.h"
class TestDistance: public QObject
{
Q_OBJECT
public:
virtual ~TestDistance();
private slots:
void jensen_shannon();
};
TestDistance::~TestDistance() {}
void TestDistance::jensen_shannon()
{
DiseasePackage pkg("CRC.zip");
}
QTEST_MAIN(TestDistance);