Results 1 to 3 of 3

Thread: Compiler error with qtcreator and qtestlib

  1. #1
    Join Date
    Nov 2011
    Posts
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default 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 :
    Qt Code:
    1. make: *** No rule to make target « ../git-cpim-/tests/mihmaptest.moc », needed by « mihmaptest.o ». Stop.
    To copy to clipboard, switch view to plain text mode 

    My Test class, my main and my .pro are quite basic.
    Qt Code:
    1. #include <QObject>
    2. #include <QtTest/QtTest>
    3.  
    4. class MihMapTest : public QObject{
    5. Q_OBJECT
    6.  
    7. private slots:
    8. void testFlux(){ QCOMPARE(0,0); }
    9. };
    10. #include "mihmaptest.moc"
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. int main(int argc, char* argv[]){
    2. QApplication app(argc, argv);
    3. MihMapTest hmaptest;
    4. QTest::qExec(&hmaptest, argc, argv);
    5. return 0;
    6. }
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. QT += core gui opengl testlib
    2. QT -= gui
    3.  
    4. TARGET = CPIMTest
    5. CONFIG += console qtestlib
    6.  
    7. TEMPLATE = app
    8.  
    9. QMAKE_CXXFLAGS += -DHAVE_CONFIG_H
    10.  
    11. SOURCES += tests/main.cpp \
    12. tests/mihmaptest.cpp
    13.  
    14. HEADERS += model/mihmap.h
    To copy to clipboard, switch view to plain text mode 

    What did I do wrong ?
    Thanks for your help.
    Last edited by azmeuk; 15th November 2011 at 12:19.

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default 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.
    Qt Code:
    1. HEADERS += tests/mihmaptest.cpp
    To copy to clipboard, switch view to plain text mode 


    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.
    Last edited by MarekR22; 15th November 2011 at 12:45.

  3. #3
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Compiler error with qtcreator and qtestlib

    Running qmake should help if there's anything wrong with the moc files.

Similar Threads

  1. Missing manifest for QtCore4d.dll
    By walmit in forum Installation and Deployment
    Replies: 1
    Last Post: 2nd June 2012, 03:16
  2. QtCreator compiler options
    By soxs060389 in forum Installation and Deployment
    Replies: 2
    Last Post: 2nd December 2011, 00:19
  3. compiler and app error with qtcreator 2.3 and 4..7.4
    By creatio.x in forum Installation and Deployment
    Replies: 2
    Last Post: 6th September 2011, 09:16
  4. Replies: 8
    Last Post: 16th February 2011, 05:16
  5. Replies: 2
    Last Post: 28th April 2009, 08:37

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.