Compiler error with qtcreator and qtestlib
Hi,
In order to debug my current Qt project, I've created a second project containing my test classes and I have some issue with compilation :
Code:
make: *** No rule to make target « ../git-cpim-/tests/mihmaptest.moc », needed by « mihmaptest.o ». Stop.
My Test class, my main and my .pro are quite basic.
Code:
#include <QObject>
#include <QtTest/QtTest>
Q_OBJECT
private slots:
void testFlux(){ QCOMPARE(0,0); }
};
#include "mihmaptest.moc"
Code:
int main(int argc, char* argv[]){
MihMapTest hmaptest;
QTest::qExec(&hmaptest, argc, argv);
return 0;
}
Code:
QT += core gui opengl testlib
QT -= gui
TARGET = CPIMTest
CONFIG += console qtestlib
TEMPLATE = app
QMAKE_CXXFLAGS += -DHAVE_CONFIG_H
SOURCES += tests/main.cpp \
tests/mihmaptest.cpp
HEADERS += model/mihmap.h
What did I do wrong ?
Thanks for your help.
Re: Compiler error with qtcreator and qtestlib
make complains that it can't find: ../git-cpim-/tests/mihmaptest.moc file.
This file is auto-generated from header file. Since you have no header file for MihMapTest make simple cheat and add source file (mihmaptest.cpp) as a header in project file.
Code:
HEADERS += tests/mihmaptest.cpp
Anyway my solution is a hack. Your code/project should work (at least something similar is working for me), maybe you should first try clean project and try build it again.
Re: Compiler error with qtcreator and qtestlib
Running qmake should help if there's anything wrong with the moc files.